Package org.moera.lib.crypto
Class Password
java.lang.Object
org.moera.lib.crypto.Password
Utility class for password hashing and validation.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Password
public Password()
-
-
Method Details
-
hash
Generates a hash for the given password using a randomly generated salt.- Parameters:
password
- the password to be hashed- Returns:
- the hashed password as a Base64-encoded string that includes the hash and the salt
-
validate
Validates if the provided password matches the given hash, using the salt embedded in the hash.- Parameters:
hash
- the Base64-encoded string containing the hash and the saltpassword
- the password to validate against the hash- Returns:
true
if the password matches the hash,false
otherwise
-