From 8c9933b3a4041a2e280f966d3a73f63e8b7d0e87 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 17 Oct 2024 20:10:49 -0300 Subject: Remove panicky code --- tests/scrypt.go | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'tests/scrypt.go') diff --git a/tests/scrypt.go b/tests/scrypt.go index 16ea570..cb97b08 100644 --- a/tests/scrypt.go +++ b/tests/scrypt.go @@ -4,7 +4,7 @@ import ( "crypto/sha1" "crypto/sha256" "encoding/base64" - "encoding/hex" + // "encoding/hex" "hash" g "gobang" @@ -353,6 +353,9 @@ func test_scrypt() { func test_SaltFrom() { g.TestStart("SaltFrom()") + + g.Testing("error when reader errors", func() { + }) // FIXME } @@ -369,6 +372,7 @@ func test_CheckFrom() { func test_Salt() { g.TestStart("Salt()") + /* g.Testing("we generate a random salt of a fixed size", func() { salt := Salt() g.TAssertEqual(len(salt), saltMinLength) @@ -377,16 +381,25 @@ func test_Salt() { hex.Encode(buffer[:], salt) // FIXME }) + */ } func test_Hash() { g.TestStart("Hash()") g.Testing("same input, same output", func() { - password := Salt() - salt := Salt() - hash1 := Hash(password, salt) - hash2 := Hash(password, salt) + password, err := Salt() + g.TErrorIf(err) + + salt, err := Salt() + g.TErrorIf(err) + + hash1, err := Hash(password, salt) + g.TErrorIf(err) + + hash2, err := Hash(password, salt) + g.TErrorIf(err) + g.TAssertEqual(hash1, hash2) }) } -- cgit v1.2.3