speps / go-hashids

Go (golang) implementation of http://www.hashids.org
MIT License
1.32k stars 109 forks source link

Returns wrong sequences instead of error when the hash manually changed #18

Closed olebedev closed 7 years ago

olebedev commented 8 years ago

The JS version just returns an empty array.

Example with salt -70d0ch47b07: Encode [42, 1, 255] -> KafyS8p. If we change the first symbol to u, DecodeWithError produces [42, 21, 999] from uafyS8p without the error. JS version returns an empty array.

How can I solve this issue?

speps commented 8 years ago

I don't see why this is an issue. That hash could have been produced by you encoding those numbers. Is "u" part of your alphabet? If it is, then it's normal behaviour. I don't know why the JS version returns an empty array, I couldn't repro your issue in there, the hash is different with the salt and numbers you've given. If you can give me more information like what to paste into the JS link you gave to repro the problem, it would help :)

speps commented 7 years ago

Let me know if you can provide more information on this, a proper repro link along with the same JS and Go code would help a lot.