speps/go-hashids

Returns wrong sequences instead of error when the hash manually changed

Closed this issue · 2 comments

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

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

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.