From 4f8c7f434842fdc0d29beb47f9c98989794afe15 Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Fri, 10 Apr 2015 11:07:30 +1000 Subject: [PATCH] ecdsa: 1.6.1 moved to relevant section --- src/ecdsa.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ecdsa.js b/src/ecdsa.js index 89d4d0d..56f35f4 100644 --- a/src/ecdsa.js +++ b/src/ecdsa.js @@ -177,14 +177,16 @@ function recoverPubKey (curve, e, signature, i) { var nR = R.multiply(n) assert(curve.isInfinity(nR), 'nR is not a valid curve point') + // Compute r^-1 + var rInv = r.modInverse(n) + // Compute -e from e var eNeg = e.negate().mod(n) // 1.6.1 Compute Q = r^-1 (sR - eG) // Q = r^-1 (sR + -eG) - var rInv = r.modInverse(n) - var Q = R.multiplyTwo(s, G, eNeg).multiply(rInv) + curve.validate(Q) return Q