noble-secp256k1
Advanced tools
Comparing version 1.2.8 to 1.2.9
38
index.js
@@ -56,8 +56,8 @@ "use strict"; | ||
const Z1 = this.z; | ||
const A = X1 ** 2n; | ||
const B = Y1 ** 2n; | ||
const C = B ** 2n; | ||
const D = 2n * ((X1 + B) ** 2n - A - C); | ||
const E = 3n * A; | ||
const F = E ** 2n; | ||
const A = mod(X1 ** 2n); | ||
const B = mod(Y1 ** 2n); | ||
const C = mod(B ** 2n); | ||
const D = mod(2n * (mod(mod((X1 + B) ** 2n)) - A - C)); | ||
const E = mod(3n * A); | ||
const F = mod(E ** 2n); | ||
const X3 = mod(F - 2n * D); | ||
@@ -82,8 +82,8 @@ const Y3 = mod(E * (D - X3) - 8n * C); | ||
return other; | ||
const Z1Z1 = Z1 ** 2n; | ||
const Z2Z2 = Z2 ** 2n; | ||
const U1 = X1 * Z2Z2; | ||
const U2 = X2 * Z1Z1; | ||
const S1 = Y1 * Z2 * Z2Z2; | ||
const S2 = Y2 * Z1 * Z1Z1; | ||
const Z1Z1 = mod(Z1 ** 2n); | ||
const Z2Z2 = mod(Z2 ** 2n); | ||
const U1 = mod(X1 * Z2Z2); | ||
const U2 = mod(X2 * Z1Z1); | ||
const S1 = mod(Y1 * Z2 * Z2Z2); | ||
const S2 = mod(mod(Y2 * Z1) * Z1Z1); | ||
const H = mod(U2 - U1); | ||
@@ -101,3 +101,3 @@ const r = mod(S2 - S1); | ||
const HHH = mod(H * HH); | ||
const V = U1 * HH; | ||
const V = mod(U1 * HH); | ||
const X3 = mod(r ** 2n - HHH - 2n * V); | ||
@@ -603,3 +603,4 @@ const Y3 = mod(r * (V - X3) - S1 * HHH); | ||
} | ||
async function getQRSrfc6979(msgHash, privKey) { | ||
async function getQRSrfc6979(msgHash, privateKey) { | ||
const privKey = normalizePrivateKey(privateKey); | ||
let [h1, h1n, x, v, k, b0, b1] = _abc6979(msgHash, privKey); | ||
@@ -621,3 +622,4 @@ const hmac = exports.utils.hmacSha256; | ||
} | ||
function getQRSrfc6979Sync(msgHash, privKey) { | ||
function getQRSrfc6979Sync(msgHash, privateKey) { | ||
const privKey = normalizePrivateKey(privateKey); | ||
let [h1, h1n, x, v, k, b0, b1] = _abc6979(msgHash, privKey); | ||
@@ -740,9 +742,7 @@ const hmac = exports.utils.hmacSha256; | ||
async function sign(msgHash, privKey, opts = {}) { | ||
const qrs = await getQRSrfc6979(msgHash, normalizePrivateKey(privKey)); | ||
return QRSToSig(qrs, opts, typeof msgHash === 'string'); | ||
return QRSToSig(await getQRSrfc6979(msgHash, privKey), opts, typeof msgHash === 'string'); | ||
} | ||
exports.sign = sign; | ||
function _syncSign(msgHash, privKey, opts = {}) { | ||
const qrs = getQRSrfc6979Sync(msgHash, normalizePrivateKey(privKey)); | ||
return QRSToSig(qrs, opts, typeof msgHash === 'string'); | ||
return QRSToSig(getQRSrfc6979Sync(msgHash, privKey), opts, typeof msgHash === 'string'); | ||
} | ||
@@ -749,0 +749,0 @@ exports._syncSign = _syncSign; |
{ | ||
"name": "noble-secp256k1", | ||
"version": "1.2.8", | ||
"version": "1.2.9", | ||
"description": "Fastest JS implementation of secp256k1. Independently audited, high-security, 0-dependency ECDSA & Schnorr signatures", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53455