Hashing function templated