-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
Array hashing is in Ruby 1.8 mode #2437
Comments
We calculate based on array length and hash of the elements, with some bitshifting etc. Based on MRI's implementation it appears we're missing a few things:
|
I can take this up tonight, looks like a nice bug get started. |
Here is the change, https://gist.github.com/Who828/056848941c6efee4044e |
I think it's a good idea to have one per runtime. I'm not entirely sure the full impact, there may be some issues relating to shared objects between runtimes. |
#2443 gets us using proper hashing algorithm but does not include salting. I'll file a separate issue for that, since I think we need a bit more discussion about what to use for salt. |
Had to revert the patch because it has other issues. |
The index and realLength passed into the hash was not for the bytelist but for the array. That was one thing I noticed. The other issue I saw too was [nil, false].hash nil.toString().getBytes() seems to return null? |
Looks like this is fixed in 9.1.10.0: [].hash
=> 5632391355580947474
[2].hash
=> 4399786657182928470 |
Woot, thanks! |
Different arrays, are hashing very similarly
MRI's behaviour is different:
The text was updated successfully, but these errors were encountered: