From 81bc721c5cd0330547e18bfb710d68d60da4dd46 Mon Sep 17 00:00:00 2001 From: obscuren Date: Thu, 3 Jul 2014 10:03:58 +0200 Subject: Fixed address generation --- ethcrypto/crypto.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'ethcrypto/crypto.go') diff --git a/ethcrypto/crypto.go b/ethcrypto/crypto.go index 8cb0be88c..b4bb881a0 100644 --- a/ethcrypto/crypto.go +++ b/ethcrypto/crypto.go @@ -3,8 +3,8 @@ package ethcrypto import ( "code.google.com/p/go.crypto/ripemd160" "crypto/sha256" + "github.com/ethereum/eth-go/ethutil" "github.com/obscuren/sha3" - "math/big" ) func Sha256Bin(data []byte) []byte { @@ -28,8 +28,6 @@ func Sha3Bin(data []byte) []byte { } // Creates an ethereum address given the bytes and the nonce -func CreateAddress(b []byte, nonce *big.Int) []byte { - addrBytes := append(b, nonce.Bytes()...) - - return Sha3Bin(addrBytes)[12:] +func CreateAddress(b []byte, nonce uint64) []byte { + return Sha3Bin(ethutil.NewValue([]interface{}{b, nonce}).Encode())[12:] } -- cgit