diff options
Diffstat (limited to 'crypto/crypto_test.go')
-rw-r--r-- | crypto/crypto_test.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/crypto/crypto_test.go b/crypto/crypto_test.go index af62a02a2..41c05a242 100644 --- a/crypto/crypto_test.go +++ b/crypto/crypto_test.go @@ -3,7 +3,12 @@ package crypto import ( "bytes" "encoding/hex" + "fmt" "testing" + "time" + + "github.com/ethereum/go-ethereum/ethutil" + "github.com/obscuren/secp256k1-go" ) // These tests are sanity checks. @@ -34,3 +39,24 @@ 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)) +} + +func Test0Key(t *testing.T) { + + key := ethutil.Hex2Bytes("1111111111111111111111111111111111111111111111111111111111111111") + + p, err := secp256k1.GeneratePubKey(key) + addr := Sha3(p[1:])[12:] + fmt.Printf("%x\n", p) + fmt.Printf("%v %x\n", err, addr) +} |