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/benchmarks/hash/main.go | 1 + tests/benchmarks/hash/scrypt.go | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 120000 tests/benchmarks/hash/main.go create mode 100644 tests/benchmarks/hash/scrypt.go (limited to 'tests/benchmarks/hash') diff --git a/tests/benchmarks/hash/main.go b/tests/benchmarks/hash/main.go new file mode 120000 index 0000000..f67563d --- /dev/null +++ b/tests/benchmarks/hash/main.go @@ -0,0 +1 @@ +../../main.go \ No newline at end of file diff --git a/tests/benchmarks/hash/scrypt.go b/tests/benchmarks/hash/scrypt.go new file mode 100644 index 0000000..82f9ed5 --- /dev/null +++ b/tests/benchmarks/hash/scrypt.go @@ -0,0 +1,28 @@ +package scrypt + +import ( + "flag" +) + + + +var nFlag = flag.Int( + "n", + 100, + "The number of iterations to execute", +) + +func MainTest() { + flag.Parse() + n := *nFlag + + password := []byte("password") + salt := []byte("salt0123456789abcdef0123456789abcdef") + + for i := 0; i < n; i++ { + _, err := Hash(password, salt) + if err != nil { + panic(err) + } + } +} -- cgit v1.2.3