Fixing hashing consistency across JVM instances.

Fixing an older pull request [1] by squashing the commits into one.

[1]: https://github.com/jruby/jruby/pull/590