1
2
3
4
5 package cryptotest
6
7 import (
8 "crypto/internal/boring"
9 "crypto/internal/fips140"
10 "hash"
11 "internal/testhash"
12 "io"
13 "math/rand"
14 "testing"
15 "time"
16 )
17
18 type MakeHash func() hash.Hash
19
20
21
22 func TestHash(t *testing.T, mh MakeHash) {
23 if boring.Enabled || fips140.Version() == "v1.0" {
24 testhash.TestHashWithoutClone(t, testhash.MakeHash(mh))
25 return
26 }
27 testhash.TestHash(t, testhash.MakeHash(mh))
28 }
29
30 func newRandReader(t *testing.T) io.Reader {
31 seed := time.Now().UnixNano()
32 t.Logf("Deterministic RNG seed: 0x%x", seed)
33 return rand.New(rand.NewSource(seed))
34 }
35
View as plain text