Enum Class PasswordHashAlgorithm
- All Implemented Interfaces:
Serializable, Comparable<PasswordHashAlgorithm>, Constable
Password hashing algorithm enumeration - 密码哈希算法枚举
密码哈希算法的枚举定义
Features | 主要功能:
- All supported password hash algorithm definitions - 所有支持的密码哈希算法定义
Usage Examples | 使用示例:
PasswordHashAlgorithm alg = PasswordHashAlgorithm.ARGON2ID;
Security | 安全性:
- Thread-safe: Yes - 线程安全: 是
- Null-safe: Partial - 空值安全: 部分
Performance | 性能特性:
- Time complexity: O(1) - 时间复杂度: O(1)
- Space complexity: O(1) - 空间复杂度: O(1)
- Since:
- JDK 25, opencode-base-crypto V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionArgon2d - Data-dependent mode, resistant to GPU attacksArgon2i - Data-independent mode, resistant to side-channel attacksArgon2id - Hybrid mode combining Argon2i and Argon2d (Recommended)BCrypt - Adaptive hash function based on Blowfish (Recommended)PBKDF2 with HMAC-SHA256PBKDF2 with HMAC-SHA512SCrypt - Password-based key derivation function (Recommended) -
Method Summary
Modifier and TypeMethodDescriptiongetName()Gets the algorithm name 获取算法名称booleanChecks if this algorithm is recommended for use 检查算法是否推荐使用static PasswordHashAlgorithmReturns the enum constant of this class with the specified name.static PasswordHashAlgorithm[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
ARGON2ID
Argon2id - Hybrid mode combining Argon2i and Argon2d (Recommended) -
ARGON2D
Argon2d - Data-dependent mode, resistant to GPU attacks -
ARGON2I
Argon2i - Data-independent mode, resistant to side-channel attacks -
BCRYPT
BCrypt - Adaptive hash function based on Blowfish (Recommended) -
SCRYPT
SCrypt - Password-based key derivation function (Recommended) -
PBKDF2_SHA256
PBKDF2 with HMAC-SHA256 -
PBKDF2_SHA512
PBKDF2 with HMAC-SHA512
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getName
-
isRecommended
public boolean isRecommended()Checks if this algorithm is recommended for use 检查算法是否推荐使用Argon2id, BCrypt, and SCrypt are recommended for modern password hashing due to their resistance to various attacks and tunable cost parameters
- Returns:
- true if the algorithm is recommended, false otherwise
-