Class MurmurHash2
This is a very fast, non-cryptographic hash suitable for general hash-based lookup. See http://murmurhash.googlepages.com/ for more details.
The C version of MurmurHash 2.0 found at that site was ported to Java by Andrzej Bialecki (ab at getopt org). The code from getopt.org was adapted by Mark Harwood in the form here as one of a pluggable choice of hashing functions as the core function had to be adapted to work with Lucene.Net.Util.BytesRefs with offsets and lengths rather than raw byte arrays.Note
This API is experimental and might change in incompatible ways in the next release.
Inherited Members
Namespace: Lucene.Net.Codecs.Bloom
Assembly: Lucene.Net.Codecs.dll
Syntax
public sealed class MurmurHash2 : HashFunction
Fields
INSTANCE
This is a very fast, non-cryptographic hash suitable for general hash-based lookup. See http://murmurhash.googlepages.com/ for more details.
The C version of MurmurHash 2.0 found at that site was ported to Java by Andrzej Bialecki (ab at getopt org). The code from getopt.org was adapted by Mark Harwood in the form here as one of a pluggable choice of hashing functions as the core function had to be adapted to work with Lucene.Net.Util.BytesRefs with offsets and lengths rather than raw byte arrays.Note
This API is experimental and might change in incompatible ways in the next release.
Declaration
public static readonly MurmurHash2 INSTANCE
Field Value
Type | Description |
---|---|
MurmurHash2 |
Methods
Hash(BytesRef)
Hashes the contents of the referenced bytes.
Declaration
public override int Hash(BytesRef br)
Parameters
Type | Name | Description |
---|---|---|
BytesRef | br |
Returns
Type | Description |
---|---|
int | The hash of the bytes referenced by bytes.offset and length bytes.Length. |
Overrides
Hash(byte[], int, int, int)
This is a very fast, non-cryptographic hash suitable for general hash-based lookup. See http://murmurhash.googlepages.com/ for more details.
The C version of MurmurHash 2.0 found at that site was ported to Java by Andrzej Bialecki (ab at getopt org). The code from getopt.org was adapted by Mark Harwood in the form here as one of a pluggable choice of hashing functions as the core function had to be adapted to work with Lucene.Net.Util.BytesRefs with offsets and lengths rather than raw byte arrays.Note
This API is experimental and might change in incompatible ways in the next release.
Declaration
public static int Hash(byte[] data, int seed, int offset, int len)
Parameters
Type | Name | Description |
---|---|---|
byte[] | data | |
int | seed | |
int | offset | |
int | len |
Returns
Type | Description |
---|---|
int |
Hash32(byte[], int, int)
Generates 32 bit hash from byte array with default seed value.
Declaration
public static int Hash32(byte[] data, int offset, int len)
Parameters
Type | Name | Description |
---|---|---|
byte[] | data | Byte array to hash. |
int | offset | The start position in the array to hash. |
int | len | Length of the array elements to hash. |
Returns
Type | Description |
---|---|
int | 32 bit hash of the given array. |