aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorGustav Simonsson <gustav.simonsson@gmail.com>2015-06-03 20:44:29 +0800
committerGustav Simonsson <gustav.simonsson@gmail.com>2015-06-03 20:44:29 +0800
commitedbd902a1b5e2d8d1fdff8e876594eb1859839e8 (patch)
tree14b883bf9103f3a2f7341c175bfc338f091780e3 /crypto
parent32e1b104f8fbc0f80bf2b6a93492aa01fa323e35 (diff)
downloaddexon-edbd902a1b5e2d8d1fdff8e876594eb1859839e8.tar
dexon-edbd902a1b5e2d8d1fdff8e876594eb1859839e8.tar.gz
dexon-edbd902a1b5e2d8d1fdff8e876594eb1859839e8.tar.bz2
dexon-edbd902a1b5e2d8d1fdff8e876594eb1859839e8.tar.lz
dexon-edbd902a1b5e2d8d1fdff8e876594eb1859839e8.tar.xz
dexon-edbd902a1b5e2d8d1fdff8e876594eb1859839e8.tar.zst
dexon-edbd902a1b5e2d8d1fdff8e876594eb1859839e8.zip
Initialise curve N value in package init
Diffstat (limited to 'crypto')
-rw-r--r--crypto/crypto.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/crypto.go b/crypto/crypto.go
index d5291fe1d..9aef44863 100644
--- a/crypto/crypto.go
+++ b/crypto/crypto.go
@@ -27,9 +27,12 @@ import (
"golang.org/x/crypto/ripemd160"
)
+var secp256k1n *big.Int
+
func init() {
// specify the params for the s256 curve
ecies.AddParamsForCurve(S256(), ecies.ECIES_AES128_SHA256)
+ secp256k1n = common.String2Big("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141")
}
func Sha3(data ...[]byte) []byte {
@@ -153,7 +156,6 @@ func GenerateKey() (*ecdsa.PrivateKey, error) {
}
func ValidateSignatureValues(v byte, r, s *big.Int) bool {
- secp256k1n := common.String2Big("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141")
vint := uint32(v)
if r.Cmp(common.Big0) == 0 || s.Cmp(common.Big0) == 0 {
return false