aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/crypto.go
diff options
context:
space:
mode:
authorkiel barry <kiel.j.barry@gmail.com>2018-05-09 07:17:09 +0800
committerFelix Lange <fjl@users.noreply.github.com>2018-05-09 07:17:09 +0800
commitba975dc0931b9f2962b2f163675772458ed339fd (patch)
tree9e2e4d2265cfdad52289d15abcc9f2b56fcddebe /crypto/crypto.go
parenteab6e5a317acf67409f82bc5c1f4d959413dfd47 (diff)
downloadgo-tangerine-ba975dc0931b9f2962b2f163675772458ed339fd.tar
go-tangerine-ba975dc0931b9f2962b2f163675772458ed339fd.tar.gz
go-tangerine-ba975dc0931b9f2962b2f163675772458ed339fd.tar.bz2
go-tangerine-ba975dc0931b9f2962b2f163675772458ed339fd.tar.lz
go-tangerine-ba975dc0931b9f2962b2f163675772458ed339fd.tar.xz
go-tangerine-ba975dc0931b9f2962b2f163675772458ed339fd.tar.zst
go-tangerine-ba975dc0931b9f2962b2f163675772458ed339fd.zip
crypto: fix golint warnings (#16710)
Diffstat (limited to 'crypto/crypto.go')
-rw-r--r--crypto/crypto.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/crypto/crypto.go b/crypto/crypto.go
index 1c4d5a2e0..76d1ffaf6 100644
--- a/crypto/crypto.go
+++ b/crypto/crypto.go
@@ -35,8 +35,8 @@ import (
)
var (
- secp256k1_N, _ = new(big.Int).SetString("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141", 16)
- secp256k1_halfN = new(big.Int).Div(secp256k1_N, big.NewInt(2))
+ secp256k1N, _ = new(big.Int).SetString("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141", 16)
+ secp256k1halfN = new(big.Int).Div(secp256k1N, big.NewInt(2))
)
// Keccak256 calculates and returns the Keccak256 hash of the input data.
@@ -68,7 +68,7 @@ func Keccak512(data ...[]byte) []byte {
return d.Sum(nil)
}
-// Creates an ethereum address given the bytes and the nonce
+// CreateAddress creates an ethereum address given the bytes and the nonce
func CreateAddress(b common.Address, nonce uint64) common.Address {
data, _ := rlp.EncodeToBytes([]interface{}{b, nonce})
return common.BytesToAddress(Keccak256(data)[12:])
@@ -99,7 +99,7 @@ func toECDSA(d []byte, strict bool) (*ecdsa.PrivateKey, error) {
priv.D = new(big.Int).SetBytes(d)
// The priv.D must < N
- if priv.D.Cmp(secp256k1_N) >= 0 {
+ if priv.D.Cmp(secp256k1N) >= 0 {
return nil, fmt.Errorf("invalid private key, >=N")
}
// The priv.D must not be zero or negative.
@@ -184,11 +184,11 @@ func ValidateSignatureValues(v byte, r, s *big.Int, homestead bool) bool {
}
// reject upper range of s values (ECDSA malleability)
// see discussion in secp256k1/libsecp256k1/include/secp256k1.h
- if homestead && s.Cmp(secp256k1_halfN) > 0 {
+ if homestead && s.Cmp(secp256k1halfN) > 0 {
return false
}
// Frontier: allow s to be in full N range
- return r.Cmp(secp256k1_N) < 0 && s.Cmp(secp256k1_N) < 0 && (v == 0 || v == 1)
+ return r.Cmp(secp256k1N) < 0 && s.Cmp(secp256k1N) < 0 && (v == 0 || v == 1)
}
func PubkeyToAddress(p ecdsa.PublicKey) common.Address {