summaryrefslogtreecommitdiff
path: root/src/scrypt.go
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-09-28 06:38:23 -0300
committerEuAndreh <eu@euandre.org>2024-09-28 06:38:23 -0300
commitf356328c9ffae6580cf788007588c3dc8c63cbae (patch)
tree4f5e819810fc960612b5643e38c1600815b7c380 /src/scrypt.go
parentsrc/scrypt.go: Remove "scrypt" prefix from consts (diff)
downloadscrypt-f356328c9ffae6580cf788007588c3dc8c63cbae.tar.gz
scrypt-f356328c9ffae6580cf788007588c3dc8c63cbae.tar.xz
src/scrypt.go: Rename XxxError to ErrXxx
Diffstat (limited to 'src/scrypt.go')
-rw-r--r--src/scrypt.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/scrypt.go b/src/scrypt.go
index 267cb08..8451467 100644
--- a/src/scrypt.go
+++ b/src/scrypt.go
@@ -30,9 +30,9 @@ const (
var (
- BadNError = errors.New("scrypt: N must be > 1 and a power of 2")
- ParamsTooLargeError = errors.New("scrypt: parameters are too large")
- SaltTooSmallError = errors.New("scrypt: salt is too small")
+ ErrBadN = errors.New("scrypt: N must be > 1 and a power of 2")
+ ErrParamsTooLarge = errors.New("scrypt: parameters are too large")
+ ErrSaltTooSmall = errors.New("scrypt: salt is too small")
)
@@ -285,14 +285,14 @@ func smix(b []byte, r int, N int, v []uint32, xy []uint32) {
func validateParams(N int, r int, p int) error {
if N <= 1 || N & (N - 1) != 0 {
- return BadNError
+ return ErrBadN
}
if ((uint64(r) * uint64(p)) >= (1 << 30)) ||
r > maxInt / 128 / p ||
r > maxInt / 256 ||
N > maxInt / 128 / r {
- return ParamsTooLargeError
+ return ErrParamsTooLarge
}
return nil
@@ -354,7 +354,7 @@ func SaltFrom(r io.Reader) ([]byte, error) {
func HashFrom(password []byte, salt []byte) ([]byte, error) {
if len(salt) < saltMinLength {
- return nil, SaltTooSmallError
+ return nil, ErrSaltTooSmall
}
hash, err := scrypt(