added in the hashing function from the spec