diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-16 18:27:38 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-16 18:27:38 +0800 |
commit | b5234413611ce5984292f85a01de1f56c045b490 (patch) | |
tree | e6e0c6f7fe8358a2dc63cdea11ac66b4f59397f5 /crypto/crypto.go | |
parent | 0b8f66ed9ef177dc72442dd7ba337c6733e30344 (diff) | |
download | go-tangerine-b5234413611ce5984292f85a01de1f56c045b490.tar.gz go-tangerine-b5234413611ce5984292f85a01de1f56c045b490.tar.zst go-tangerine-b5234413611ce5984292f85a01de1f56c045b490.zip |
Moved ethutil => common
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") |