Ether Framework
Unified API docs for Ether modules
Loading...
Searching...
No Matches
dev.rafex.ether.crypto.password.PasswordHasherPBKDF2 Class Reference

PBKDF2-HMAC-SHA256 password hasher ported from Kiwi and HouseDB. More...

Inheritance diagram for dev.rafex.ether.crypto.password.PasswordHasherPBKDF2:
Collaboration diagram for dev.rafex.ether.crypto.password.PasswordHasherPBKDF2:

Public Member Functions

PasswordHash hash (final char[] password, final byte[] salt, final int iterations)
 Hashes a password using PBKDF2-HMAC-SHA256.
 PasswordHasherPBKDF2 (final int derivedKeyBytes)
 Creates a new PBKDF2 password hasher.
boolean verify (final char[] password, final byte[] salt, final int iterations, final byte[] expectedHash)
 Verifies a password against an expected hash using PBKDF2-HMAC-SHA256.

Detailed Description

PBKDF2-HMAC-SHA256 password hasher ported from Kiwi and HouseDB.

Definition at line 37 of file PasswordHasherPBKDF2.java.

Constructor & Destructor Documentation

◆ PasswordHasherPBKDF2()

dev.rafex.ether.crypto.password.PasswordHasherPBKDF2.PasswordHasherPBKDF2 ( final int derivedKeyBytes)

Creates a new PBKDF2 password hasher.

Parameters
derivedKeyBytesThe number of bytes for the derived key (minimum 16).
Exceptions
IllegalArgumentExceptionif derivedKeyBytes is less than 16.

Definition at line 49 of file PasswordHasherPBKDF2.java.

Member Function Documentation

◆ hash()

PasswordHash dev.rafex.ether.crypto.password.PasswordHasherPBKDF2.hash ( final char[] password,
final byte[] salt,
final int iterations )

Hashes a password using PBKDF2-HMAC-SHA256.

Parameters
passwordThe password to hash.
saltThe random salt bytes.
iterationsThe number of PBKDF2 iterations.
Returns
The resulting PasswordHash.
Exceptions
IllegalArgumentExceptionif password is null, salt is null or empty, or iterations is not positive.

Implements dev.rafex.ether.crypto.password.PasswordHasher.

Definition at line 89 of file PasswordHasherPBKDF2.java.

References dev.rafex.ether.crypto.password.PasswordHash().

Here is the call graph for this function:

◆ verify()

boolean dev.rafex.ether.crypto.password.PasswordHasherPBKDF2.verify ( final char[] password,
final byte[] salt,
final int iterations,
final byte[] expectedHash )

Verifies a password against an expected hash using PBKDF2-HMAC-SHA256.

Parameters
passwordThe password to verify.
saltThe random salt bytes.
iterationsThe number of PBKDF2 iterations.
expectedHashThe expected hash bytes.
Returns
true if the password matches the expected hash, false otherwise.

Implements dev.rafex.ether.crypto.password.PasswordHasher.

Definition at line 66 of file PasswordHasherPBKDF2.java.


The documentation for this class was generated from the following file: