This commit is contained in:
insanity@loafle.com 2017-05-26 17:28:53 +09:00
parent 167cb6268d
commit 0f658e598c

View File

@ -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
}