Python implementation of various hash functions