Hashing functions implemented in JavaScript