pre-pow
This commit is contained in:
@ -3,7 +3,9 @@ package crypto
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
// These tests are sanity checks.
|
||||
@ -34,3 +36,14 @@ func checkhash(t *testing.T, name string, f func([]byte) []byte, msg, exp []byte
|
||||
t.Errorf("hash %s returned wrong result.\ngot: %x\nwant: %x", name, sum, exp)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkSha3(b *testing.B) {
|
||||
a := []byte("hello world")
|
||||
amount := 1000000
|
||||
start := time.Now()
|
||||
for i := 0; i < amount; i++ {
|
||||
Sha3(a)
|
||||
}
|
||||
|
||||
fmt.Println(amount, ":", time.Since(start))
|
||||
}
|
||||
|
Reference in New Issue
Block a user