From e37c1fc7fe6b211c05f9124653c9b338e587ca8a Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 19 Oct 2024 09:07:14 -0300 Subject: src/scrypt.go: Create HashInput and CheckInput for named arguments --- tests/scrypt.go | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'tests/scrypt.go') 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 } -- cgit v1.2.3