Interface MetroHash<R extends MetroHash<R>>

Type Parameters:
R - 返回值类型,为this类型
All Known Implementing Classes:
AbstractMetroHash, MetroHash128, MetroHash64

public interface MetroHash<R extends MetroHash<R>>
Apache 发布的MetroHash算法接口,是一组用于非加密用例的最先进的哈希函数。 除了卓越的性能外,他们还以算法生成而著称。

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

    Modifier and Type
    Method
    Description
    将给定的ByteBuffer中的数据追加计算hash值 此方法会更新hash值状态
    static MetroHash<?>
    of(long seed, boolean is128)
    创建 MetroHash对象
    重置,重置后可复用对象开启新的计算
    write(ByteBuffer output, ByteOrder byteOrder)
    将结果hash值写出到ByteBuffer中,可选端序
  • Method Details

    • of

      static MetroHash<?> of(long seed, boolean is128)
      创建 MetroHash对象
      Parameters:
      seed - 种子
      is128 - 是否128位
      Returns:
      MetroHash对象
    • apply

      R apply(ByteBuffer input)
      将给定的ByteBuffer中的数据追加计算hash值 此方法会更新hash值状态
      Parameters:
      input - 内容
      Returns:
      this
    • write

      R write(ByteBuffer output, ByteOrder byteOrder)
      将结果hash值写出到ByteBuffer中,可选端序
      Parameters:
      output - 输出
      byteOrder - 端序
      Returns:
      this
    • reset

      R reset()
      重置,重置后可复用对象开启新的计算
      Returns:
      this