Coder Social home page Coder Social logo

Comments (5)

manigandham avatar manigandham commented on May 29, 2024

Do you want to make a PR for the documentation and add a test to confirm?

from hashids.net.

aradalvand avatar aradalvand commented on May 29, 2024

Actually, upon further testing I found out it's not 24 characters, it has to do with the length of the alphabet which I think you've already alluded to in the "Features" section of the README:

Allows custom alphabet as well as salt — so ids are unique only to you. (salt must be smaller than alphabet)

Although one might argue this isn't precise enough, because it's not exactly alphabet - 1, for a 36-character alphabet, for instance, (0-9 + A-Z) it seems like the salt limit is 24, for a 51-character alphabet, the limit seems to be 36.

I'm not sure what the formula is exactly 🤔

from hashids.net.

manigandham avatar manigandham commented on May 29, 2024

It's the alphabet - 1 - separators.

The separators are characters used to denote the different integers combined into a single ID. There's a default list of 14 characters, with 7 letters in both lower and uppercase. If these occur in the alphabet then they're removed from the available characters.

If you only pass in a lowercase alphabet then it'll remove those 7 lowercase characters, otherwise it'll remove all 14.

https://github.com/ullmark/hashids.net/blob/master/src/Hashids.net/Hashids.cs#L72

from hashids.net.

aradalvand avatar aradalvand commented on May 29, 2024

Oh okay, good to know.
I think it'd be helpful to mention this in the README.

from hashids.net.

manigandham avatar manigandham commented on May 29, 2024

Readme has been updated with notes on config and usage.

from hashids.net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.