Package com.djrapitops.plan.utilities
Class PassEncryptUtil
- java.lang.Object
-
- com.djrapitops.plan.utilities.PassEncryptUtil
-
public class PassEncryptUtil extends java.lang.Object
Password Encryption utility.https://github.com/defuse/password-hashing/blob/master/PasswordStorage.java
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PassEncryptUtil.CannotPerformOperationException
static class
PassEncryptUtil.InvalidHashException
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
createHash(java.lang.String password)
Create a hash of password + salt.static boolean
verifyPassword(java.lang.String password, java.lang.String correctHash)
Verify that a password matches a hash.
-
-
-
Method Detail
-
createHash
public static java.lang.String createHash(java.lang.String password)
Create a hash of password + salt.- Parameters:
password
- Password- Returns:
- Hash + salt
- Throws:
PassEncryptUtil.CannotPerformOperationException
- If the hash creation fails
-
verifyPassword
public static boolean verifyPassword(java.lang.String password, java.lang.String correctHash)
Verify that a password matches a hash.- Parameters:
password
- PasswordcorrectHash
- hash created withcreateHash(String)
- Returns:
- true if match
- Throws:
PassEncryptUtil.CannotPerformOperationException
- If hashing failsPassEncryptUtil.InvalidHashException
- If the hash is missing details.
-
-