summaryrefslogtreecommitdiff
path: root/tests/fuzz/api/scrypt.go
blob: 7c2c50396aee81b468c77f61da705e7fe4774463 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package scrypt

import (
	"os"
	"testing"
	"testing/internal/testdeps"
)



func api(f *testing.F) {
	f.Fuzz(func(t *testing.T, password []byte, salt []byte) {
		if len(salt) < _SALT_MIN_LENGTH {
			return
		}

		input := HashInputT{
			Password: password,
			Salt:     salt,
		}
		_, err := Hash(input)
		if err != nil {
			t.Errorf("Failed on: %#v\n", err)
		}
	})
}



func MainTest() {
	fuzzTargets := []testing.InternalFuzzTarget{
		{ "api", api },
	}

	deps := testdeps.TestDeps{}
	tests      := []testing.InternalTest     {}
	benchmarks := []testing.InternalBenchmark{}
	examples   := []testing.InternalExample  {}
	m := testing.MainStart(deps, tests, benchmarks, fuzzTargets, examples)
	os.Exit(m.Run())
}