Class SCryptHash.Builder

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

public static class SCryptHash.Builder extends Object
Builder for creating custom SCryptHash instances 用于创建自定义 SCryptHash 实例的构建器
Since:
JDK 25, opencode-base-crypto V1.0.0
Author:
Leon Soo www.LeonSoo.com
  • Method Details

    • workFactor

      public SCryptHash.Builder workFactor(int n)
      Set CPU/memory cost parameter (N) 设置 CPU/内存成本参数(N)
      Parameters:
      n - work factor (must be power of 2, minimum 2)
      Returns:
      this builder
    • blockSize

      public SCryptHash.Builder blockSize(int r)
      Set block size parameter (r) 设置块大小参数(r)
      Parameters:
      r - block size (minimum 1)
      Returns:
      this builder
    • parallelism

      public SCryptHash.Builder parallelism(int p)
      Set parallelization parameter (p) 设置并行化参数(p)
      Parameters:
      p - parallelism (minimum 1)
      Returns:
      this builder
    • keyLength

      public SCryptHash.Builder keyLength(int length)
      Set key output length in bytes 设置密钥输出长度(字节)
      Parameters:
      length - key length in bytes (minimum 16)
      Returns:
      this builder
    • secureRandom

      public SCryptHash.Builder secureRandom(SecureRandom secureRandom)
      Set custom SecureRandom instance 设置自定义 SecureRandom 实例
      Parameters:
      secureRandom - the SecureRandom instance
      Returns:
      this builder
    • build

      public SCryptHash build()
      Build the SCryptHash instance 构建 SCryptHash 实例
      Returns:
      new SCryptHash instance