Fast version of str2type using perfect hashing function: the hashing function itself.