Implement faster hashing function