@@ -35,8 +35,8 @@ import (
35
35
)
36
36
37
37
var (
38
- secp256k1_N , _ = new (big.Int ).SetString ("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141" , 16 )
39
- secp256k1_halfN = new (big.Int ).Div (secp256k1_N , big .NewInt (2 ))
38
+ secp256k1N , _ = new (big.Int ).SetString ("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141" , 16 )
39
+ secp256k1halfN = new (big.Int ).Div (secp256k1N , big .NewInt (2 ))
40
40
)
41
41
42
42
// Keccak256 calculates and returns the Keccak256 hash of the input data.
@@ -68,7 +68,7 @@ func Keccak512(data ...[]byte) []byte {
68
68
return d .Sum (nil )
69
69
}
70
70
71
- // Creates an ethereum address given the bytes and the nonce
71
+ // CreateAddress creates an ethereum address given the bytes and the nonce
72
72
func CreateAddress (b common.Address , nonce uint64 ) common.Address {
73
73
data , _ := rlp .EncodeToBytes ([]interface {}{b , nonce })
74
74
return common .BytesToAddress (Keccak256 (data )[12 :])
@@ -99,7 +99,7 @@ func toECDSA(d []byte, strict bool) (*ecdsa.PrivateKey, error) {
99
99
priv .D = new (big.Int ).SetBytes (d )
100
100
101
101
// The priv.D must < N
102
- if priv .D .Cmp (secp256k1_N ) >= 0 {
102
+ if priv .D .Cmp (secp256k1N ) >= 0 {
103
103
return nil , fmt .Errorf ("invalid private key, >=N" )
104
104
}
105
105
// The priv.D must not be zero or negative.
@@ -184,11 +184,11 @@ func ValidateSignatureValues(v byte, r, s *big.Int, homestead bool) bool {
184
184
}
185
185
// reject upper range of s values (ECDSA malleability)
186
186
// see discussion in secp256k1/libsecp256k1/include/secp256k1.h
187
- if homestead && s .Cmp (secp256k1_halfN ) > 0 {
187
+ if homestead && s .Cmp (secp256k1halfN ) > 0 {
188
188
return false
189
189
}
190
190
// Frontier: allow s to be in full N range
191
- return r .Cmp (secp256k1_N ) < 0 && s .Cmp (secp256k1_N ) < 0 && (v == 0 || v == 1 )
191
+ return r .Cmp (secp256k1N ) < 0 && s .Cmp (secp256k1N ) < 0 && (v == 0 || v == 1 )
192
192
}
193
193
194
194
func PubkeyToAddress (p ecdsa.PublicKey ) common.Address {
0 commit comments