Revised ide recommendations

This commit is contained in:
kenneth 2023-03-15 18:06:30 +08:00
parent 6a518665d7
commit 39d23d0b8c
2 changed files with 4 additions and 1 deletions

View File

@ -48,6 +48,9 @@ func ScryptComparePassword(storedPassword string, suppliedPassword string) (bool
}
shash, err := scrypt.Key([]byte(suppliedPassword), salt, 32768, 8, 1, 32)
if err != nil {
return false, err
}
return hex.EncodeToString(shash) == pwsalt[0], nil
}

View File

@ -26,7 +26,7 @@ func RSAEncrypt(origData []byte) ([]byte, error) {
func RSADecrypt(ciphertext []byte) ([]byte, error) {
block, _ := pem.Decode(privateKey)
if block == nil {
return nil, errors.New("private key error!")
return nil, errors.New("private key error")
}
priv, err := x509.ParsePKCS1PrivateKey(block.Bytes)
if err != nil {