public class PasswordUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
PasswordUtils.CannotPerformOperationException |
static class |
PasswordUtils.InvalidHashException |
| Constructor and Description |
|---|
PasswordUtils() |
| Modifier and Type | Method and Description |
|---|---|
static String |
createHash(char[] password)
创建一个密文密码
|
static String |
createHash(String password)
创建一个密文密码
|
static boolean |
verifyPassword(char[] password,
String correctHash)
验证密码
|
static boolean |
verifyPassword(String password,
String correctHash)
验证密码
|
public static String createHash(String password) throws PasswordUtils.CannotPerformOperationException
password - 明文密码PasswordUtils.CannotPerformOperationExceptionpublic static String createHash(char[] password) throws PasswordUtils.CannotPerformOperationException
password - 明文密码字符数组PasswordUtils.CannotPerformOperationExceptionpublic static boolean verifyPassword(String password, String correctHash)
password - 明文密码correctHash - 密文密码public static boolean verifyPassword(char[] password,
String correctHash)
throws PasswordUtils.CannotPerformOperationException,
PasswordUtils.InvalidHashException
password - 明文密码字符数组correctHash - 密文密码PasswordUtils.CannotPerformOperationExceptionPasswordUtils.InvalidHashExceptionCopyright © 2020. All rights reserved.