aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorFelix Lange <fjl@twurst.com>2015-03-17 19:01:40 +0800
committerFelix Lange <fjl@twurst.com>2015-03-17 19:01:40 +0800
commitee7202fa00198abaa423a1483468ca979ac9f3f4 (patch)
tree0f332b84b73997aca73b4d508ab7e8ccf9687bcf /crypto
parent65eee2006d649b2b4f4fef9332d339444bb479b1 (diff)
parent515d9432fcef8c574627049d437d6898b56c2829 (diff)
downloaddexon-ee7202fa00198abaa423a1483468ca979ac9f3f4.tar.gz
dexon-ee7202fa00198abaa423a1483468ca979ac9f3f4.tar.zst
dexon-ee7202fa00198abaa423a1483468ca979ac9f3f4.zip
Merge remote-tracking branch 'ethereum/conversion' into conversion
Diffstat (limited to 'crypto')
-rw-r--r--crypto/crypto.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/crypto/crypto.go b/crypto/crypto.go
index ec2b41042..c3d47b629 100644
--- a/crypto/crypto.go
+++ b/crypto/crypto.go
@@ -20,6 +20,7 @@ import (
"github.com/ethereum/go-ethereum/crypto/ecies"
"github.com/ethereum/go-ethereum/crypto/secp256k1"
"github.com/ethereum/go-ethereum/crypto/sha3"
+ "github.com/ethereum/go-ethereum/rlp"
"golang.org/x/crypto/pbkdf2"
"golang.org/x/crypto/ripemd160"
)
@@ -47,8 +48,10 @@ func Sha3Hash(data ...[]byte) (h common.Hash) {
}
// Creates an ethereum address given the bytes and the nonce
-func CreateAddress(b []byte, nonce uint64) []byte {
- return Sha3(common.NewValue([]interface{}{b, nonce}).Encode())[12:]
+func CreateAddress(b common.Address, nonce uint64) common.Address {
+ data, _ := rlp.EncodeToBytes([]interface{}{b, nonce})
+ return common.BytesToAddress(Sha3(data)[12:])
+ //return Sha3(common.NewValue([]interface{}{b, nonce}).Encode())[12:]
}
func Sha256(data []byte) []byte {