Class MetroHash128

All Implemented Interfaces:
Encoder<byte[],Number>, Hash128<byte[]>, MetroHash<MetroHash128>

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

官方实现: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

    • MetroHash128

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

    • of

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

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

      public No128 get()
      获取结果hash值
      Returns:
      hash值
    • hash128

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

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