aboutsummaryrefslogtreecommitdiffstats
path: root/ethcrypto
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-07-03 16:03:58 +0800
committerobscuren <geffobscura@gmail.com>2014-07-03 16:03:58 +0800
commit81bc721c5cd0330547e18bfb710d68d60da4dd46 (patch)
tree91eb6c324e092e8330e7b6b60eef3897fd646654 /ethcrypto
parent35ae9e3aa89dc0e3be1cabed313996a7d49f6628 (diff)
downloadgo-tangerine-81bc721c5cd0330547e18bfb710d68d60da4dd46.tar.gz
go-tangerine-81bc721c5cd0330547e18bfb710d68d60da4dd46.tar.zst
go-tangerine-81bc721c5cd0330547e18bfb710d68d60da4dd46.zip
Fixed address generation
Diffstat (limited to 'ethcrypto')
-rw-r--r--ethcrypto/crypto.go8
1 files changed, 3 insertions, 5 deletions
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:]
}