polished hash functions and tests