Interface LLPasswordAlgorithmType

All Known Implementing Classes:
LLPasswordAlgorithmPBKDF2HmacSHA256

public sealed interface LLPasswordAlgorithmType permits LLPasswordAlgorithmPBKDF2HmacSHA256
The type of password hashing algorithms.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    check(String expectedHash, String receivedPassword, byte[] salt)
    Check if the given plain text password matches the expected hash.
    default LLPassword
    createHashed(String passwordText)
    Create a hashed password with a random salt.
    createHashed(String passwordText, byte[] salt)
    Create a hashed password.
     
  • Method Details

    • check

      boolean check(String expectedHash, String receivedPassword, byte[] salt) throws LLPasswordException
      Check if the given plain text password matches the expected hash.
      Parameters:
      expectedHash - The expected hexadecimal uppercase hash
      receivedPassword - The received plain text password
      salt - The salt value
      Returns:
      true if the password matches
      Throws:
      LLPasswordException - On com.io7m.looseleaf.cmdline.internal errors such as missing algorithm support
    • createHashed

      LLPassword createHashed(String passwordText, byte[] salt) throws LLPasswordException
      Create a hashed password.
      Parameters:
      passwordText - The plain text password
      salt - A random salt value
      Returns:
      A hashed password
      Throws:
      LLPasswordException - On com.io7m.looseleaf.cmdline.internal errors such as missing algorithm support
    • createHashed

      default LLPassword createHashed(String passwordText) throws LLPasswordException
      Create a hashed password with a random salt.
      Parameters:
      passwordText - The plain text password
      Returns:
      A hashed password
      Throws:
      LLPasswordException - On com.io7m.looseleaf.cmdline.internal errors such as missing algorithm support
    • identifier

      String identifier()
      Returns:
      The password algorithm identifier