aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/key.go
diff options
context:
space:
mode:
authorPaweł Bylica <pawel.bylica@imapp.pl>2015-01-23 22:37:37 +0800
committerPaweł Bylica <pawel.bylica@imapp.pl>2015-01-23 22:37:37 +0800
commit3aa0410f6ecaa6a44c8e7fa0164cc3209eb6cb8e (patch)
treebebbffe2cbbd78f2bb01805a31685cfbfdaaea70 /crypto/key.go
parentd5f38f5690caeb30794e62d4a1b2683a6107cfbc (diff)
parentd792e95c214c8352e6b23b798101e90844eaa7a3 (diff)
downloaddexon-3aa0410f6ecaa6a44c8e7fa0164cc3209eb6cb8e.tar
dexon-3aa0410f6ecaa6a44c8e7fa0164cc3209eb6cb8e.tar.gz
dexon-3aa0410f6ecaa6a44c8e7fa0164cc3209eb6cb8e.tar.bz2
dexon-3aa0410f6ecaa6a44c8e7fa0164cc3209eb6cb8e.tar.lz
dexon-3aa0410f6ecaa6a44c8e7fa0164cc3209eb6cb8e.tar.xz
dexon-3aa0410f6ecaa6a44c8e7fa0164cc3209eb6cb8e.tar.zst
dexon-3aa0410f6ecaa6a44c8e7fa0164cc3209eb6cb8e.zip
Merge remote-tracking branch 'upstream/develop' into 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
}