substring change to substr
This commit is contained in:
parent
7fb2590670
commit
fcf41dd77e
2
index.js
2
index.js
@ -1351,7 +1351,7 @@ class TICrypto {
|
|||||||
const prime = new BigInt('fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f', 16) // 2^256 - 2^32 - 2^9 - 2^8 - 2^7 - 2^6 - 2^4 - 1
|
const prime = new BigInt('fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f', 16) // 2^256 - 2^32 - 2^9 - 2^8 - 2^7 - 2^6 - 2^4 - 1
|
||||||
const pIdent = new BigInt('3fffffffffffffffffffffffffffffffffffffffffffffffffffffffbfffff0c', 16) // prime.add(1).divide(4);
|
const pIdent = new BigInt('3fffffffffffffffffffffffffffffffffffffffffffffffffffffffbfffff0c', 16) // prime.add(1).divide(4);
|
||||||
var signY = new Number(compressed[1]) - 2
|
var signY = new Number(compressed[1]) - 2
|
||||||
var x = new BigInt(compressed.substring(2), 16)
|
var x = new BigInt(compressed.substr(2), 16)
|
||||||
var y = x.modPow(3, prime).add(7).mod(prime).modPow(pIdent, prime) // y mod p = +-(x^3 + 7)^((p+1)/4) mod p
|
var y = x.modPow(3, prime).add(7).mod(prime).modPow(pIdent, prime) // y mod p = +-(x^3 + 7)^((p+1)/4) mod p
|
||||||
if (y.mod(2).toJSNumber() !== signY) {
|
if (y.mod(2).toJSNumber() !== signY) {
|
||||||
// If the parity doesn't match it's the *other* root
|
// If the parity doesn't match it's the *other* root
|
||||||
|
Loading…
Reference in New Issue
Block a user