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

hash collision #48

Closed arianne-detorres closed 4 years ago

arianne-detorres commented 4 years ago

Hi, I'm using hashids to encode internal ids in our system, however I noticed a few collisions:

Hashids hashids = new Hashids( salt, 8, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" );
System.out.println(hashids.encode( 5551008 ));
System.out.println(hashids.encode( 5552196 ));

Returns:

mnbgLzGm
mnbgLZGm

Any ideas as to how this can happen? From the documentation, it seems this should be impossible. We're using the latest version (1.0.3)

miquelfire commented 4 years ago

You'll need to post in the library of the language you're using. There might be a bug with that language's implentation.

jd327 commented 4 years ago

Generated ids are case-sensitive by default. As you can see in your example, the "z" is different.