From 9b3458e7d263b1535716ed30e27e6507ee9b3c91 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 18 Oct 2024 08:52:08 -0300 Subject: Add baseline functional test, fuzz target and benchmark --- tests/functional/hash-and-check/scrypt.go | 40 +++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 tests/functional/hash-and-check/scrypt.go (limited to 'tests/functional/hash-and-check/scrypt.go') diff --git a/tests/functional/hash-and-check/scrypt.go b/tests/functional/hash-and-check/scrypt.go new file mode 100644 index 0000000..17f2982 --- /dev/null +++ b/tests/functional/hash-and-check/scrypt.go @@ -0,0 +1,40 @@ +package scrypt + +import ( + g "gobang" + +) + + + +func MainTest() { + g.Testing("from a known input we check the hash", func() { + const ( + password = "a fixed password" + salt = "a fixed salt____________________" + ) + + hash, err := Hash([]byte(password), []byte(salt)) + g.TErrorIf(err) + + ok, err := Check([]byte(password), []byte(salt), hash) + g.TErrorIf(err) + g.TAssertEqual(ok, true) + }) + + g.Testing("we can genereate a hash and check it is equal", func() { + password, err := Salt() + g.TErrorIf(err) + + salt, err := Salt() + g.TErrorIf(err) + + hash, err := Hash(password, salt) + g.TErrorIf(err) + + ok, err := Check(password, salt, hash) + g.TErrorIf(err) + + g.TAssertEqual(ok, true) + }) +} -- cgit v1.2.3