Class MetroHash64

All Implemented Interfaces:
Encoder<byte[],Number>, Hash64<byte[]>, MetroHash<MetroHash64>

public class MetroHash64 extends AbstractMetroHash<MetroHash64> implements Hash64<byte[]>
Apache 发布的MetroHash算法的64位实现,是一组用于非加密用例的最先进的哈希函数。 除了卓越的性能外,他们还以算法生成而著称。

官方实现:https://github.com/jandrewrogers/MetroHash 官方文档:http://www.jandrewrogers.com/2015/05/27/metrohash/ 来自:https://github.com/postamar/java-metrohash/

Since:
Java 17+
Author:
Kimi Liu
  • Constructor Details

    • MetroHash64

      public MetroHash64(long seed)
      使用指定种子构造
      Parameters:
      seed - 种子
  • Method Details

    • of

      public static MetroHash64 of(long seed)
      创建 MetroHash64对象
      Parameters:
      seed - 种子
      Returns:
      MetroHash64对象
    • reset

      public MetroHash64 reset()
      Description copied from interface: MetroHash
      重置,重置后可复用对象开启新的计算
      Specified by:
      reset in interface MetroHash<MetroHash64>
      Returns:
      this
    • get

      public long get()
      获取计算结果hash值
      Returns:
      hash值
    • hash64

      public long hash64(byte[] bytes)
      Description copied from interface: Hash64
      计算Hash值
      Specified by:
      hash64 in interface Hash64<byte[]>
      Parameters:
      bytes - 对象
      Returns:
      hash
    • write

      public MetroHash64 write(ByteBuffer output, ByteOrder byteOrder)
      Description copied from interface: MetroHash
      将结果hash值写出到ByteBuffer中,可选端序
      Specified by:
      write in interface MetroHash<MetroHash64>
      Parameters:
      output - 输出
      byteOrder - 端序
      Returns:
      this