-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathsha3_test.go
54 lines (49 loc) · 1.14 KB
/
sha3_test.go
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
42
43
44
45
46
47
48
49
50
51
52
53
54
package keccak
import (
"bytes"
"testing"
)
func TestSHA3224(t *testing.T) {
h := NewSHA3224()
for i := range tstShort {
h.Reset()
h.Write(sha3tests[i].msg)
d := h.Sum(nil)
if !bytes.Equal(d, sha3tests[i].output224) {
t.Errorf("testcase SHA3224 %d: expected %x got %x", i, sha3tests[i].output224, d)
}
}
}
func TestSHA3256(t *testing.T) {
h := NewSHA3256()
for i := range sha3tests {
h.Reset()
h.Write(sha3tests[i].msg)
d := h.Sum(nil)
if !bytes.Equal(d, sha3tests[i].output256) {
t.Errorf("testcase SHA3256 %d: expected %x got %x", i, sha3tests[i].output256, d)
}
}
}
func TestSHA3384(t *testing.T) {
h := NewSHA3384()
for i := range sha3tests {
h.Reset()
h.Write(sha3tests[i].msg)
d := h.Sum(nil)
if !bytes.Equal(d, sha3tests[i].output384) {
t.Errorf("testcase SHA3384 %d: expected %x got %x", i, sha3tests[i].output384, d)
}
}
}
func TestSHA3512(t *testing.T) {
h := NewSHA3512()
for i := range sha3tests {
h.Reset()
h.Write(sha3tests[i].msg)
d := h.Sum(nil)
if !bytes.Equal(d, sha3tests[i].output512) {
t.Errorf("testcase SHA3512 %d: expected %x got %x", i, sha3tests[i].output512, d)
}
}
}