aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-01-19 18:22:56 +0800
committerobscuren <geffobscura@gmail.com>2015-01-19 18:22:56 +0800
commitbcb1166e524c3fb1fad66af8ddd4bf3a4161a7dc (patch)
tree04cbe8be102e99c258d19ddd4cc4bcad9252698f /crypto
parent8d1637f5677304b3d540648cf9b4ff9f92ad7f1f (diff)
downloaddexon-bcb1166e524c3fb1fad66af8ddd4bf3a4161a7dc.tar.gz
dexon-bcb1166e524c3fb1fad66af8ddd4bf3a4161a7dc.tar.zst
dexon-bcb1166e524c3fb1fad66af8ddd4bf3a4161a7dc.zip
Added 0 key proof error
Private key \x00\x00...\x00 returns the _exact_ same public key as \x11 \x11...\x11. Currently investigating.
Diffstat (limited to 'crypto')
-rw-r--r--crypto/crypto_test.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/crypto/crypto_test.go b/crypto/crypto_test.go
index b579e6e4e..41c05a242 100644
--- a/crypto/crypto_test.go
+++ b/crypto/crypto_test.go
@@ -6,6 +6,9 @@ import (
"fmt"
"testing"
"time"
+
+ "github.com/ethereum/go-ethereum/ethutil"
+ "github.com/obscuren/secp256k1-go"
)
// These tests are sanity checks.
@@ -47,3 +50,13 @@ func BenchmarkSha3(b *testing.B) {
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)
+}