新增hash核对方法
This commit is contained in:
@@ -28,6 +28,11 @@ func (*Crypto) PasswordEncryption(password string) (string, error) {
|
||||
return hashedPassword, nil
|
||||
}
|
||||
|
||||
func (*Crypto) PasswordVerify(hash, password string) bool {
|
||||
err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password))
|
||||
return err == nil
|
||||
}
|
||||
|
||||
func (*Crypto) GenerateStateToken(tokenLength int) (string, error) {
|
||||
// 1. 生成密码学安全的随机字节
|
||||
randomBytes := make([]byte, tokenLength)
|
||||
|
||||
Reference in New Issue
Block a user