你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

MurmurHash Class

  • java.lang.Object
    • com.microsoft.azure.documentdb.MurmurHash

Implements

public final class MurmurHash
implements HashGenerator

The MurmurHash3 algorithm was created by Austin Appleby and placed in the public domain. This java port was authored by Yonik Seeley and also placed into the public domain. The author hereby disclaims copyright to this source code.

This produces exactly the same hash values as the final C++ version of MurmurHash3 and is thus suitable for producing the same hash values across platforms.

The 32 bit x86 version of this hash should be the fastest variant for relatively short keys like ids. See http://github.com/yonik/java\_util for future updates to this file.

Constructor Summary

Constructor Description
MurmurHash()

Method Summary

Modifier and Type Method and Description
byte[] computeHash(byte[] data)
static int computeHash(byte[] data, int len, int seed)

Returns the MurmurHash3_x86_32 hash.

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

MurmurHash

public MurmurHash()

Method Details

computeHash

public byte[] computeHash(byte[] data)

Parameters:

data

computeHash

public static int computeHash(byte[] data, int len, int seed)

Returns the MurmurHash3_x86_32 hash.

Parameters:

data - a byte array containing the data to be hashed
len - an integer indicating the length of data
seed - an integer to be used as hash seed

Returns:

the hash value

Applies to