diff options
author | EuAndreh <eu@euandre.org> | 2024-10-19 09:07:14 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2024-10-19 09:07:14 -0300 |
commit | e37c1fc7fe6b211c05f9124653c9b338e587ca8a (patch) | |
tree | 4b73a455eafe03646403e4ae84dab50ce53bb834 /tests/functional | |
parent | Remove Go code in favor of upstream libscrypt-kdf (diff) | |
download | scrypt-e37c1fc7fe6b211c05f9124653c9b338e587ca8a.tar.gz scrypt-e37c1fc7fe6b211c05f9124653c9b338e587ca8a.tar.xz |
src/scrypt.go: Create HashInput and CheckInput for named arguments
Diffstat (limited to 'tests/functional')
-rw-r--r-- | tests/functional/hash-and-check/scrypt.go | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/tests/functional/hash-and-check/scrypt.go b/tests/functional/hash-and-check/scrypt.go index 17f2982..065b9b5 100644 --- a/tests/functional/hash-and-check/scrypt.go +++ b/tests/functional/hash-and-check/scrypt.go @@ -9,15 +9,24 @@ import ( func MainTest() { g.Testing("from a known input we check the hash", func() { - const ( - password = "a fixed password" - salt = "a fixed salt____________________" + var ( + password = []byte("a fixed password") + salt = []byte("a fixed salt____________________") ) - hash, err := Hash([]byte(password), []byte(salt)) + hashInput := HashInput{ + Password: password, + Salt: salt, + } + hash, err := Hash(hashInput) g.TErrorIf(err) - ok, err := Check([]byte(password), []byte(salt), hash) + checkInput := CheckInput{ + Password: password, + Salt: salt, + Hash: hash, + } + ok, err := Check(checkInput) g.TErrorIf(err) g.TAssertEqual(ok, true) }) @@ -29,10 +38,19 @@ func MainTest() { salt, err := Salt() g.TErrorIf(err) - hash, err := Hash(password, salt) + hashInput := HashInput{ + Password: password, + Salt: salt, + } + hash, err := Hash(hashInput) g.TErrorIf(err) - ok, err := Check(password, salt, hash) + checkInput := CheckInput{ + Password: password, + Salt: salt, + Hash: hash, + } + ok, err := Check(checkInput) g.TErrorIf(err) g.TAssertEqual(ok, true) |