Class Argon2Hash.Builder
java.lang.Object
cloud.opencode.base.crypto.password.Argon2Hash.Builder
- Enclosing class:
Argon2Hash
Builder for creating customized Argon2 hashers
用于创建自定义 Argon2 哈希器的构建器
- Since:
- JDK 25, opencode-base-crypto V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Build the Argon2Hash instance 构建 Argon2Hash 实例hashLength(int hashLength) Set the hash output length in bytes 设置哈希输出长度(字节)iterations(int iterations) Set the number of iterations (time cost) 设置迭代次数(时间成本)memory(int memory) Set the memory cost in kilobytes 设置内存成本(千字节)parallelism(int parallelism) Set the parallelism factor (number of threads) 设置并行因子(线程数)saltLength(int saltLength) Set the salt length in bytes 设置盐值长度(字节)secureRandom(SecureRandom secureRandom) Set the SecureRandom instance for salt generation 设置用于盐值生成的 SecureRandom 实例type(Argon2Type type) Set the Argon2 variant type 设置 Argon2 变体类型
-
Method Details
-
type
Set the Argon2 variant type 设置 Argon2 变体类型- Parameters:
type- the Argon2 type (ARGON2D, ARGON2I, or ARGON2ID)- Returns:
- this builder
-
saltLength
Set the salt length in bytes 设置盐值长度(字节)- Parameters:
saltLength- salt length (recommended: 16 bytes minimum)- Returns:
- this builder
-
hashLength
Set the hash output length in bytes 设置哈希输出长度(字节)- Parameters:
hashLength- hash length (recommended: 32 bytes)- Returns:
- this builder
-
iterations
Set the number of iterations (time cost) 设置迭代次数(时间成本)- Parameters:
iterations- iteration count (recommended: 3-4 for interactive use)- Returns:
- this builder
-
memory
Set the memory cost in kilobytes 设置内存成本(千字节)- Parameters:
memory- memory in KB (recommended: 65536 KB = 64 MB)- Returns:
- this builder
-
parallelism
Set the parallelism factor (number of threads) 设置并行因子(线程数)- Parameters:
parallelism- number of parallel threads (recommended: 4)- Returns:
- this builder
-
secureRandom
Set the SecureRandom instance for salt generation 设置用于盐值生成的 SecureRandom 实例- Parameters:
secureRandom- the SecureRandom instance- Returns:
- this builder
-
build
Build the Argon2Hash instance 构建 Argon2Hash 实例- Returns:
- configured Argon2Hash instance
-