Class PasswordHash

java.lang.Object
io.getlime.security.powerauth.crypto.lib.util.PasswordHash

public class PasswordHash extends Object
Utility class that provides password hashing functionality using the Argon2 algorithm.
Author:
Roman Strobl, roman.strobl@wultra.com
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    hash(byte[] password)
    Generate hash in Argon2 Modular Crypt Format for specified password using Argon2i algorithm.
    static boolean
    verify(byte[] password, String argon2Hash)
    Verify password hash for specified password and password hash in Modular Crypt Format.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PasswordHash

      public PasswordHash()
  • Method Details

    • hash

      public static String hash(byte[] password) throws CryptoProviderException
      Generate hash in Argon2 Modular Crypt Format for specified password using Argon2i algorithm.
      Parameters:
      password - Password bytes.
      Returns:
      Hash String in Argon2 Modular Crypt Format.
      Throws:
      CryptoProviderException - In case key cryptography provider is incorrectly initialized.
    • verify

      public static boolean verify(byte[] password, String argon2Hash) throws IOException
      Verify password hash for specified password and password hash in Modular Crypt Format.
      Parameters:
      password - Password bytes for verification.
      argon2Hash - Password hash in Argon2 Modular Crypt Format.
      Returns:
      Whether password verification succeeded.
      Throws:
      IOException - In case parsing of hash fails.