Hashing implementations in Java