diff options
Diffstat (limited to 'crypto/crypto.go')
-rw-r--r-- | crypto/crypto.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crypto/crypto.go b/crypto/crypto.go index 90e2c8939..bc72928ac 100644 --- a/crypto/crypto.go +++ b/crypto/crypto.go @@ -19,7 +19,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/ethutil" + "github.com/ethereum/go-ethereum/common" "golang.org/x/crypto/pbkdf2" "golang.org/x/crypto/ripemd160" ) @@ -39,7 +39,7 @@ func Sha3(data ...[]byte) []byte { // Creates an ethereum address given the bytes and the nonce func CreateAddress(b []byte, nonce uint64) []byte { - return Sha3(ethutil.NewValue([]interface{}{b, nonce}).Encode())[12:] + return Sha3(common.NewValue([]interface{}{b, nonce}).Encode())[12:] } func Sha256(data []byte) []byte { @@ -74,7 +74,7 @@ func ToECDSA(prv []byte) *ecdsa.PrivateKey { priv := new(ecdsa.PrivateKey) priv.PublicKey.Curve = S256() - priv.D = ethutil.BigD(prv) + priv.D = common.BigD(prv) priv.PublicKey.X, priv.PublicKey.Y = S256().ScalarBaseMult(prv) return priv } @@ -143,7 +143,7 @@ func Sign(hash []byte, prv *ecdsa.PrivateKey) (sig []byte, err error) { return nil, fmt.Errorf("hash is required to be exactly 32 bytes (%d)", len(hash)) } - sig, err = secp256k1.Sign(hash, ethutil.LeftPadBytes(prv.D.Bytes(), prv.Params().BitSize/8)) + sig, err = secp256k1.Sign(hash, common.LeftPadBytes(prv.D.Bytes(), prv.Params().BitSize/8)) return } @@ -198,7 +198,7 @@ func decryptPreSaleKey(fileContent []byte, password string) (key *Key, err error Address: PubkeyToAddress(ecKey.PublicKey), PrivateKey: ecKey, } - derivedAddr := ethutil.Bytes2Hex(key.Address) + derivedAddr := common.Bytes2Hex(key.Address) expectedAddr := preSaleKeyStruct.EthAddr if derivedAddr != expectedAddr { err = errors.New("decrypted addr not equal to expected addr") |