Class SimpleHashFunction
java.lang.Object
org.hibernate.search.util.common.data.impl.SimpleHashFunction
- All Implemented Interfaces:
HashFunction
A fast, but cryptographically insecure hash function,
based on Java's
String.toString().-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptioninthash(CharSequence key) Hashes akey, i.e. turns it into an integer for use in aHashTable.toString()
-
Field Details
-
INSTANCE
-
-
Method Details
-
toString
-
hash
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.
-