aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/key.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-01-27 23:30:38 +0800
committerobscuren <geffobscura@gmail.com>2015-01-27 23:30:38 +0800
commitfe14b0b82e10ce92309e6af4b13c6eec20d8df87 (patch)
tree93b3825d1c34d0c39ba92ed991921457898cac7d /crypto/key.go
parenta2162258274511b13ecf002e7ec6b82f8508d7e7 (diff)
parent079c59b929d5e09eebad6169c22f146bd2f060af (diff)
downloaddexon-fe14b0b82e10ce92309e6af4b13c6eec20d8df87.tar
dexon-fe14b0b82e10ce92309e6af4b13c6eec20d8df87.tar.gz
dexon-fe14b0b82e10ce92309e6af4b13c6eec20d8df87.tar.bz2
dexon-fe14b0b82e10ce92309e6af4b13c6eec20d8df87.tar.lz
dexon-fe14b0b82e10ce92309e6af4b13c6eec20d8df87.tar.xz
dexon-fe14b0b82e10ce92309e6af4b13c6eec20d8df87.tar.zst
dexon-fe14b0b82e10ce92309e6af4b13c6eec20d8df87.zip
Merge branch 'pr/evmjit' of https://github.com/chfast/go-ethereum into chfast-pr/evmjit
Diffstat (limited to 'crypto/key.go')
-rw-r--r--crypto/key.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/crypto/key.go b/crypto/key.go
index d371ad4dc..ca29b691f 100644
--- a/crypto/key.go
+++ b/crypto/key.go
@@ -57,7 +57,7 @@ type encryptedKeyJSON struct {
func (k *Key) Address() []byte {
pubBytes := FromECDSAPub(&k.PrivateKey.PublicKey)
- return Sha3(pubBytes)[12:]
+ return Sha3(pubBytes[1:])[12:]
}
func (k *Key) MarshalJSON() (j []byte, err error) {
@@ -99,9 +99,10 @@ func NewKey(rand io.Reader) *Key {
privateKeyMarshalled := elliptic.Marshal(S256(), x, y)
privateKeyECDSA := ToECDSA(privateKeyMarshalled)
- key := new(Key)
id := uuid.NewRandom()
- key.Id = &id
- key.PrivateKey = privateKeyECDSA
+ key := &Key{
+ Id: &id,
+ PrivateKey: privateKeyECDSA,
+ }
return key
}