hashids / hashids.github.io

This is the old Hashids website. It is no longer maintained and has migrated over to Sqids.
https://sqids.org
206 stars 34 forks source link

Limit length of hash? #75

Closed toomanyjoes closed 1 year ago

toomanyjoes commented 3 years ago

Is there a way to limit the length of the hash to a certain number of character?

miquelfire commented 3 years ago

You would need to limit the number(s) used to generate the hash.

If you're only using 1 number to generated the hash, make a loop, and stop it once the number is more than the limit, and you have your max value.

4kimov commented 1 year ago

There's no way to set the max length (only min). It's not a hash, but an id. Since they're generated by encoding numbers, sooner or later you'll overflow any length.