diff options
Diffstat (limited to 'tests/functional/hash-and-check')
l--------- | tests/functional/hash-and-check/main.go | 1 | ||||
-rw-r--r-- | tests/functional/hash-and-check/scrypt.go | 40 |
2 files changed, 41 insertions, 0 deletions
diff --git a/tests/functional/hash-and-check/main.go b/tests/functional/hash-and-check/main.go new file mode 120000 index 0000000..f67563d --- /dev/null +++ b/tests/functional/hash-and-check/main.go @@ -0,0 +1 @@ +../../main.go
\ No newline at end of file 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) + }) +} |