Polishing hash functions in base/hash and added tests.
polished hash functions and tests