Skip to content
Snippets Groups Projects
Unverified Commit 02d39430 authored by Silas Davis's avatar Silas Davis Committed by GitHub
Browse files

Merge pull request #775 from b00f/patch-1

Update key.go
parents 6f779c82 ceaba272
No related branches found
No related tags found
No related merge requests found
...@@ -11,7 +11,6 @@ import ( ...@@ -11,7 +11,6 @@ import (
"github.com/tendermint/go-crypto" "github.com/tendermint/go-crypto"
"github.com/wayn3h0/go-uuid" "github.com/wayn3h0/go-uuid"
"golang.org/x/crypto/ed25519" "golang.org/x/crypto/ed25519"
"golang.org/x/crypto/ripemd160"
) )
// Mock ed25510 key for mock keys client // Mock ed25510 key for mock keys client
...@@ -38,11 +37,14 @@ func newKey(name string) (*Key, error) { ...@@ -38,11 +37,14 @@ func newKey(name string) (*Key, error) {
copy(key.PrivateKey[:], privateKey[:]) copy(key.PrivateKey[:], privateKey[:])
copy(key.PublicKey[:], publicKey[:]) copy(key.PublicKey[:], publicKey[:])
// prepend 0x01 for ed25519 public key var ed25519 crypto.PubKeyEd25519
typedPublicKeyBytes := append([]byte{0x01}, key.PublicKey...) copy(ed25519[:], publicKey[:])
hasher := ripemd160.New()
hasher.Write(typedPublicKeyBytes) key.Address, err = acm.AddressFromBytes(ed25519.Address())
key.Address, err = acm.AddressFromBytes(hasher.Sum(nil)) if err != nil {
return nil, err
}
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment