mirror of
https://github.com/fumiama/blake2b-simd.git
synced 2026-06-11 13:40:27 +08:00
Added performance comparison to other hashing techniques (#12)
This commit is contained in:
@@ -596,46 +596,3 @@ var goldenKeyed = []string{
|
||||
"d444bfa2362a96df213d070e33fa841f51334e4e76866b8139e8af3bb3398be2dfaddcbc56b9146de9f68118dc5829e74b0c28d7711907b121f9161cb92b69a9",
|
||||
"142709d62e28fcccd0af97fad0f8465b971e82201dc51070faa0372aa43e92484be1c1e73ba10906d5d1853db6a4106e0a7bf9800d373d6dee2d46d62ef2a461",
|
||||
}
|
||||
|
||||
// Benchmark blake2b implementation.
|
||||
var bench = New512()
|
||||
var buf = make([]byte, 128*1024)
|
||||
|
||||
func benchmarkSize(b *testing.B, size int) {
|
||||
b.SetBytes(int64(size))
|
||||
for i := 0; i < b.N; i++ {
|
||||
bench.Reset()
|
||||
bench.Write(buf[:size])
|
||||
bench.Sum(nil)
|
||||
}
|
||||
}
|
||||
|
||||
// Benchmark writes of 64 bytes.
|
||||
func BenchmarkHash64(b *testing.B) {
|
||||
benchmarkSize(b, 64)
|
||||
}
|
||||
|
||||
// Benchmark writes of 128 bytes.
|
||||
func BenchmarkHash128(b *testing.B) {
|
||||
benchmarkSize(b, 128)
|
||||
}
|
||||
|
||||
// Benchmark writes of 1KiB bytes.
|
||||
func BenchmarkHash1K(b *testing.B) {
|
||||
benchmarkSize(b, 1024)
|
||||
}
|
||||
|
||||
// Benchmark writes of 8KiB bytes.
|
||||
func BenchmarkHash8K(b *testing.B) {
|
||||
benchmarkSize(b, 8*1024)
|
||||
}
|
||||
|
||||
// Benchmark writes of 32KiB bytes.
|
||||
func BenchmarkHash32K(b *testing.B) {
|
||||
benchmarkSize(b, 32*1024)
|
||||
}
|
||||
|
||||
// Benchmark writes of 128KiB bytes.
|
||||
func BenchmarkHash128K(b *testing.B) {
|
||||
benchmarkSize(b, 128*1024)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user