diff options
author | obscuren <geffobscura@gmail.com> | 2015-01-23 21:29:01 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-01-23 21:29:01 +0800 |
commit | 7a894e37388fccef1fa7945bb20b7cf8f0c1ce3c (patch) | |
tree | a6d55756ec833b3651e5805726813a7ef5af3399 /crypto/key.go | |
parent | 215780ab562b940bfc653c16bf84f812ef062821 (diff) | |
parent | d792e95c214c8352e6b23b798101e90844eaa7a3 (diff) | |
download | dexon-7a894e37388fccef1fa7945bb20b7cf8f0c1ce3c.tar dexon-7a894e37388fccef1fa7945bb20b7cf8f0c1ce3c.tar.gz dexon-7a894e37388fccef1fa7945bb20b7cf8f0c1ce3c.tar.bz2 dexon-7a894e37388fccef1fa7945bb20b7cf8f0c1ce3c.tar.lz dexon-7a894e37388fccef1fa7945bb20b7cf8f0c1ce3c.tar.xz dexon-7a894e37388fccef1fa7945bb20b7cf8f0c1ce3c.tar.zst dexon-7a894e37388fccef1fa7945bb20b7cf8f0c1ce3c.zip |
Merge branch 'develop' into jsonrpc
Diffstat (limited to 'crypto/key.go')
-rw-r--r-- | crypto/key.go | 9 |
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 } |