object MurmurHash
An object designed to generate well-distributed non-cryptographic hashes. It is designed to hash a collection of integers; along with the integers to hash, it generates two magic streams of integers to increase the distribution of repetitive input sequences. Thus, three methods need to be called at each step (to start and to incorporate a new integer) to update the values. Only one method needs to be called to finalize the hash.
- Source
- MurmurHash.scala
- Alphabetic
- By Inheritance
- MurmurHash
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
def
arrayHash[T](a: Array[T]): Int
Compute a high-quality hash of an array
-
def
extendHash(hash: Int, value: Int, magicA: Int, magicB: Int): Int
Incorporates a new value into an existing hash.
Incorporates a new value into an existing hash.
- hash
the prior hash value
- value
the new value to incorporate
- magicA
a magic integer from the stream
- magicB
a magic integer from a different stream
- returns
the updated hash value
-
def
finalizeHash(hash: Int): Int
Once all hashes have been incorporated, this performs a final mixing
-
def
nextMagicA(magicA: Int): Int
Given a magic integer from the first stream, compute the next
-
def
nextMagicB(magicB: Int): Int
Given a magic integer from the second stream, compute the next
-
def
startHash(seed: Int): Int
Begin a new hash with a seed value.
-
def
startMagicA: Int
The initial magic integers in the first stream.
-
def
startMagicB: Int
The initial magic integer in the second stream.
-
def
stringHash(s: String): Int
Compute a high-quality hash of a string
-
def
symmetricHash[T](xs: IterableOnce[T], seed: Int): Int
Compute a hash that is symmetric in its arguments--that is, where the order of appearance of elements does not matter.
Compute a hash that is symmetric in its arguments--that is, where the order of appearance of elements does not matter. This is useful for hashing sets, for example.