Enum Class PasswordHashAlgorithm

java.lang.Object
java.lang.Enum<PasswordHashAlgorithm>
cloud.opencode.base.crypto.enums.PasswordHashAlgorithm
All Implemented Interfaces:
Serializable, Comparable<PasswordHashAlgorithm>, Constable

public enum PasswordHashAlgorithm extends Enum<PasswordHashAlgorithm>
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:
  • Enum Constant Details

    • ARGON2ID

      public static final PasswordHashAlgorithm ARGON2ID
      Argon2id - Hybrid mode combining Argon2i and Argon2d (Recommended)
    • ARGON2D

      public static final PasswordHashAlgorithm ARGON2D
      Argon2d - Data-dependent mode, resistant to GPU attacks
    • ARGON2I

      public static final PasswordHashAlgorithm ARGON2I
      Argon2i - Data-independent mode, resistant to side-channel attacks
    • BCRYPT

      public static final PasswordHashAlgorithm BCRYPT
      BCrypt - Adaptive hash function based on Blowfish (Recommended)
    • SCRYPT

      public static final PasswordHashAlgorithm SCRYPT
      SCrypt - Password-based key derivation function (Recommended)
    • PBKDF2_SHA256

      public static final PasswordHashAlgorithm PBKDF2_SHA256
      PBKDF2 with HMAC-SHA256
    • PBKDF2_SHA512

      public static final PasswordHashAlgorithm PBKDF2_SHA512
      PBKDF2 with HMAC-SHA512
  • Method Details

    • values

      public static PasswordHashAlgorithm[] 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

      public static PasswordHashAlgorithm valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • getName

      public String getName()
      Gets the algorithm name 获取算法名称
      Returns:
      the algorithm name
    • 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