-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
different salt can give random number or crash #20
Comments
We should not expect |
But crash should be avoid, should return empty array |
Okay good. Also in case somebody needs: duplicating the id will decrease the probability of receiving an id from an invalid token:
|
ArrayIndexOutOfBoundsException crash has been fixed in PR #27 . The collision behavior is the same as the default javascript implementation, it is just a collision within different salts. Can be less possible increasing the Collisions is not possible within the same salt, but perfectly possible in a small sample space as 4 lenght hash. [A-Z,a-z,0-9] 62^4 = almost 14 million unique values, not that much As long as I can tell, this issue can be closed, as the crash has been fixed and the collision is not a bug. |
Hi,
When using different salt it should return empty array. But I recognized the behavior is quite unpredictable, there is a probability that it decodes to a wrong number instead or crashes with an ArrayIndexOutOfBoundsException.
Here and example that will decode to a wrong number:
assertion will fail, id[0] will be 81143
Same test with sampleId = 37l will cause "ArrayIndexOutOfBoundsException"
The text was updated successfully, but these errors were encountered: