summaryrefslogtreecommitdiff
path: root/tests/functional/hash-and-check/scrypt.go
diff options
context:
space:
mode:
Diffstat (limited to 'tests/functional/hash-and-check/scrypt.go')
-rw-r--r--tests/functional/hash-and-check/scrypt.go40
1 files changed, 40 insertions, 0 deletions
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)
+ })
+}