Package google.registry.util
Class PasswordUtils
java.lang.Object
google.registry.util.PasswordUtils
Common utility class to handle password hashing and salting /*
We use a memory-hard hashing algorithm (Scrypt) to prevent brute-force attacks on passwords.
Note that in tests, we simply concatenate the password and salt which is much faster and reduces the overall test run time by a half. Our tests are not verifying that SCRYPT is implemented correctly anyway.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final com.google.common.base.Supplier
<byte[]> -
Method Summary
Modifier and TypeMethodDescriptionstatic String
hashPassword
(String password, byte[] salt) Returns the hash of the password using the provided salt.static boolean
verifyPassword
(String password, String hash, String salt) Verifies a password by regenerating the hash with the provided salt and comparing it to the provided hash.
-
Field Details
-
SALT_SUPPLIER
public static final com.google.common.base.Supplier<byte[]> SALT_SUPPLIER
-
-
Method Details
-
hashPassword
Returns the hash of the password using the provided salt. -
verifyPassword
Verifies a password by regenerating the hash with the provided salt and comparing it to the provided hash.
-