port some hash functions

port some hash functions