ullmark/hashids.net

Same id generated for different integers

csicso opened this issue · 3 comments

csicso commented

I've generated two id's for these numbers: 205, 449 (I've called twice the method)
I'm using salt, which is this: "Models.Rendszer.Cimke_ohd3mjNekCk9e9iL"
Min. hash length: 18
The encode provided the same id for the numbers: "1YOvmed9z46Lyn3w0E"
How is it possible?

csicso commented

Sorry, I was wrong :)

Hi guys
I am using this package and I really love it. However, I have run into a duplicate issue too where these two Ids are hashed to the same 17 charecter string:
518441536
520571136
the resulting hash : gOnbdg2ENEBPRP5mY
that is of coursing using the same Salt.

@ullmark is this something that is being worked on to find the root cause?

@johnseabi Hi, sorry I missed this comment in a closed issue. While building this package I may have made it possible for a consumer to set the salt/alphabet to a too simple combination that the original algoritm wasn't supposed to support.

Irregardless, it is virtually impossible to find these issues without test data, so to help anyone track down this issue, you'd have to preferably supply a test that proves the bug, or at least write which code you are running, which alphabet, salt etc.