Class MurmurHash
Murmur3 Hash implementation
Inherited Members
Namespace: Akka.Util
Assembly: Akka.dll
Syntax
public static class MurmurHash
Fields
| Edit this page View SourceStartMagicA
The initial magic integer in the first stream.
Declaration
public const uint StartMagicA = 2505324423
Field Value
Type | Description |
---|---|
uint |
StartMagicB
The initial magic integer in the second stream.
Declaration
public const uint StartMagicB = 718793509
Field Value
Type | Description |
---|---|
uint |
Methods
| Edit this page View SourceArrayHash<T>(T[])
Compute a high-quality hash of an array
Declaration
public static int ArrayHash<T>(T[] a)
Parameters
Type | Name | Description |
---|---|---|
T[] | a | The array to hash. |
Returns
Type | Description |
---|---|
int | The hash code for the array. |
Type Parameters
Name | Description |
---|---|
T |
ByteHash(byte[])
Compute a high-quality hash of a byte array
Declaration
public static int ByteHash(byte[] b)
Parameters
Type | Name | Description |
---|---|---|
byte[] | b | The byte array to hash. |
Returns
Type | Description |
---|---|
int | The hash code for the byte array. |
ExtendHash(uint, uint, uint, uint)
Incorporates a new value into an existing hash
Declaration
public static uint ExtendHash(uint hash, uint value, uint magicA, uint magicB)
Parameters
Type | Name | Description |
---|---|---|
uint | hash | The prior hash value |
uint | value | The new value to incorporate |
uint | magicA | A magic integer from the left of the stream |
uint | magicB | A magic integer from a different stream |
Returns
Type | Description |
---|---|
uint | The updated hash value |
FinalizeHash(uint)
Once all hashes have been incorporated, this performs a final mixing.
Declaration
public static uint FinalizeHash(uint hash)
Parameters
Type | Name | Description |
---|---|---|
uint | hash | The hash value to finalize. |
Returns
Type | Description |
---|---|
uint | The finalized hash value. |
NextMagicA(uint)
Given a magic integer from the first stream, compute the next
Declaration
public static uint NextMagicA(uint magicA)
Parameters
Type | Name | Description |
---|---|---|
uint | magicA | The current magic value from the first stream. |
Returns
Type | Description |
---|---|
uint | The next magic value in the first stream. |
NextMagicB(uint)
Given a magic integer from the second stream, compute the next
Declaration
public static uint NextMagicB(uint magicB)
Parameters
Type | Name | Description |
---|---|---|
uint | magicB | The current magic value from the second stream. |
Returns
Type | Description |
---|---|
uint | The next magic value in the second stream. |
StartHash(uint)
Begin a new hash with a seed value.
Declaration
public static uint StartHash(uint seed)
Parameters
Type | Name | Description |
---|---|---|
uint | seed | The seed value to initialize the hash. |
Returns
Type | Description |
---|---|
uint | The initial hash value. |
StringHash(string)
Compute high-quality hash of a string
Declaration
public static int StringHash(string s)
Parameters
Type | Name | Description |
---|---|---|
string | s | The string to hash. |
Returns
Type | Description |
---|---|
int | The hash code for the string. |
SymmetricHash<T>(IEnumerable<T>, uint)
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.
Declaration
public static int SymmetricHash<T>(IEnumerable<T> xs, uint seed)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | xs | The collection of elements to hash. |
uint | seed | The seed value for the hash. |
Returns
Type | Description |
---|---|
int | A hash code that is the same regardless of the order of elements in the collection. |
Type Parameters
Name | Description |
---|---|
T |