-
Notifications
You must be signed in to change notification settings - Fork 0
/
hmac256_test.go
43 lines (34 loc) · 940 Bytes
/
hmac256_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
package hmac256
import "testing"
func BenchmarkSmall(b *testing.B) {
hmacTestKey := []byte("xxxx")
hmacInput := []byte("Lorem ipsum")
for n := 0; n < b.N; n++ {
Digest(hmacInput, hmacTestKey)
}
}
func BenchmarkLarge(b *testing.B) {
hmacTestKey := []byte("xxxx")
hmacInput := []byte("00123014764700968325001230147647009683250012301476470096832500123014764700968325")
for n := 0; n < b.N; n++ {
Digest(hmacInput, hmacTestKey)
}
}
func BenchmarkSmallParallel(b *testing.B) {
hmacTestKey := []byte("xxxx")
hmacInput := []byte("Lorem ipsum")
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
Digest(hmacInput, hmacTestKey)
}
})
}
func BenchmarkLargeParallel(b *testing.B) {
hmacTestKey := []byte("xxxx")
hmacInput := []byte("00123014764700968325001230147647009683250012301476470096832500123014764700968325")
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
Digest(hmacInput, hmacTestKey)
}
})
}