Class Argon2Hash.Builder

java.lang.Object
cloud.opencode.base.crypto.password.Argon2Hash.Builder
Enclosing class:
Argon2Hash

public static final class Argon2Hash.Builder extends Object
Builder for creating customized Argon2 hashers 用于创建自定义 Argon2 哈希器的构建器
Since:
JDK 25, opencode-base-crypto V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Method Details

    • type

      public Argon2Hash.Builder type(Argon2Type type)
      Set the Argon2 variant type 设置 Argon2 变体类型
      Parameters:
      type - the Argon2 type (ARGON2D, ARGON2I, or ARGON2ID)
      Returns:
      this builder
    • saltLength

      public Argon2Hash.Builder saltLength(int saltLength)
      Set the salt length in bytes 设置盐值长度(字节)
      Parameters:
      saltLength - salt length (recommended: 16 bytes minimum)
      Returns:
      this builder
    • hashLength

      public Argon2Hash.Builder hashLength(int hashLength)
      Set the hash output length in bytes 设置哈希输出长度(字节)
      Parameters:
      hashLength - hash length (recommended: 32 bytes)
      Returns:
      this builder
    • iterations

      public Argon2Hash.Builder iterations(int iterations)
      Set the number of iterations (time cost) 设置迭代次数(时间成本)
      Parameters:
      iterations - iteration count (recommended: 3-4 for interactive use)
      Returns:
      this builder
    • memory

      public Argon2Hash.Builder memory(int memory)
      Set the memory cost in kilobytes 设置内存成本(千字节)
      Parameters:
      memory - memory in KB (recommended: 65536 KB = 64 MB)
      Returns:
      this builder
    • parallelism

      public Argon2Hash.Builder parallelism(int parallelism)
      Set the parallelism factor (number of threads) 设置并行因子(线程数)
      Parameters:
      parallelism - number of parallel threads (recommended: 4)
      Returns:
      this builder
    • secureRandom

      public Argon2Hash.Builder secureRandom(SecureRandom secureRandom)
      Set the SecureRandom instance for salt generation 设置用于盐值生成的 SecureRandom 实例
      Parameters:
      secureRandom - the SecureRandom instance
      Returns:
      this builder
    • build

      public Argon2Hash build()
      Build the Argon2Hash instance 构建 Argon2Hash 实例
      Returns:
      configured Argon2Hash instance