Skip to content

Commit b1a1329

Browse files
Merge pull request #7 from lvsoso/master
add sha256 parallel
2 parents 5d647f9 + cdc57fd commit b1a1329

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Diff for: hash/hash_test.go

+12
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,15 @@ func BenchmarkRIPEMD160(b *testing.B) {
179179
func BenchmarkWhirlpool(b *testing.B) {
180180
benchmarkHashAlgo(b, whirlpool.New())
181181
}
182+
183+
func BenchmarkSHA256Parallel(b *testing.B) {
184+
b.RunParallel(func(pb *testing.PB) {
185+
data := make([]byte, 2048)
186+
rand.Read(data)
187+
for pb.Next() {
188+
h := sha256.New()
189+
h.Write(data)
190+
h.Sum(nil)
191+
}
192+
})
193+
}

0 commit comments

Comments
 (0)