diff options
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/crypto.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/crypto/crypto.go b/crypto/crypto.go index 619440e81..dec6e3c19 100644 --- a/crypto/crypto.go +++ b/crypto/crypto.go @@ -76,6 +76,12 @@ func CreateAddress(b common.Address, nonce uint64) common.Address { return common.BytesToAddress(Keccak256(data)[12:]) } +// CreateAddress2 creates an ethereum address given the address bytes, initial +// contract code and a salt. +func CreateAddress2(b common.Address, salt common.Hash, code []byte) common.Address { + return common.BytesToAddress(Keccak256([]byte{0xff}, b.Bytes(), salt.Bytes(), code)[12:]) +} + // ToECDSA creates a private key with the given D value. func ToECDSA(d []byte) (*ecdsa.PrivateKey, error) { return toECDSA(d, true) |