aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/key.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-01-23 05:42:39 +0800
committerobscuren <geffobscura@gmail.com>2015-01-23 05:42:39 +0800
commita125b0fbc319a3d86f61a7e6c4036dc24a211943 (patch)
treefc75d65294b7445a91aaf66b83864ee439434d87 /crypto/key.go
parent0dfe5113709d2981ef2ec8885d831a38cf2e4f91 (diff)
parent8af42d42da1d428025622d3b76982798ec9436bd (diff)
downloadgo-tangerine-a125b0fbc319a3d86f61a7e6c4036dc24a211943.tar
go-tangerine-a125b0fbc319a3d86f61a7e6c4036dc24a211943.tar.gz
go-tangerine-a125b0fbc319a3d86f61a7e6c4036dc24a211943.tar.bz2
go-tangerine-a125b0fbc319a3d86f61a7e6c4036dc24a211943.tar.lz
go-tangerine-a125b0fbc319a3d86f61a7e6c4036dc24a211943.tar.xz
go-tangerine-a125b0fbc319a3d86f61a7e6c4036dc24a211943.tar.zst
go-tangerine-a125b0fbc319a3d86f61a7e6c4036dc24a211943.zip
Merge branch 'import_presale_keys' of https://github.com/Gustav-Simonsson/go-ethereum into Gustav-Simonsson-import_presale_keys
Conflicts: crypto/crypto.go
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
}