summaryrefslogtreecommitdiff
path: root/tests/scrypt.go
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-10-19 09:07:14 -0300
committerEuAndreh <eu@euandre.org>2024-10-19 09:07:14 -0300
commite37c1fc7fe6b211c05f9124653c9b338e587ca8a (patch)
tree4b73a455eafe03646403e4ae84dab50ce53bb834 /tests/scrypt.go
parentRemove Go code in favor of upstream libscrypt-kdf (diff)
downloadscrypt-e37c1fc7fe6b211c05f9124653c9b338e587ca8a.tar.gz
scrypt-e37c1fc7fe6b211c05f9124653c9b338e587ca8a.tar.xz
src/scrypt.go: Create HashInput and CheckInput for named arguments
Diffstat (limited to '')
-rw-r--r--tests/scrypt.go22
1 files changed, 18 insertions, 4 deletions
diff --git a/tests/scrypt.go b/tests/scrypt.go
index f499f84..710ea82 100644
--- a/tests/scrypt.go
+++ b/tests/scrypt.go
@@ -217,10 +217,15 @@ func test_Hash() {
salt, err := Salt()
g.TErrorIf(err)
- hash1, err := Hash(password, salt)
+ input := HashInput{
+ Password: password,
+ Salt: salt,
+ }
+
+ hash1, err := Hash(input)
g.TErrorIf(err)
- hash2, err := Hash(password, salt)
+ hash2, err := Hash(input)
g.TErrorIf(err)
g.TAssertEqual(hash1, hash2)
@@ -231,13 +236,22 @@ func test_Check() {
g.TestStart("Check()")
h := func(password []byte, salt []byte) []byte {
- hash, err := Hash(password, salt)
+ input := HashInput{
+ Password: password,
+ Salt: salt,
+ }
+ hash, err := Hash(input)
g.TErrorIf(err)
return hash
}
chk := func(password []byte, salt []byte, hash []byte) bool {
- ok, err := Check(password, salt, hash)
+ input := CheckInput{
+ Password: password,
+ Salt: salt,
+ Hash: hash,
+ }
+ ok, err := Check(input)
g.TErrorIf(err)
return ok
}