Fixes for hash function misuse and compatibility with other implementations.