Class SimpleHashFunction
- java.lang.Object
-
- org.hibernate.search.util.common.data.impl.SimpleHashFunction
-
- All Implemented Interfaces:
HashFunction
public final class SimpleHashFunction extends Object implements HashFunction
A fast, but cryptographically insecure hash function, based on Java'sString.toString().
-
-
Field Summary
Fields Modifier and Type Field Description static SimpleHashFunctionINSTANCE
-
-
-
Field Detail
-
INSTANCE
public static final SimpleHashFunction INSTANCE
-
-
Method Detail
-
hash
public int hash(CharSequence key)
Hashes akey, i.e. turns it into an integer for use in aHashTable.This implementation is the same hash function as Java's String.toString().
It does not delegate to String.toString() in order to protect against future changes in the JDK (?) or different JDK implementations, so that the resulting hash can safely be used for persistence (e.g. to route data to a file).
- Specified by:
hashin interfaceHashFunction- Parameters:
key- A key to hash.- Returns:
- A hash.
-
-