.
This commit is contained in:
parent
167cb6268d
commit
0f658e598c
@ -26,3 +26,14 @@ func Encrypt(pw string) ([]byte, []byte, error) {
|
|||||||
|
|
||||||
return salt, hash, nil
|
return salt, hash, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Check(pw, savedSalt, savedDigest string) bool {
|
||||||
|
hash, err := scrypt.Key([]byte(pw), []byte(savedSalt), 16384, 8, 1, PW_HASH_BYTES)
|
||||||
|
if err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
if string(hash) == savedDigest {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user