From a689c6fc9af33fc47497e86ceb85caffe3da3820 Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Wed, 16 Apr 2014 21:13:54 +1000 Subject: [PATCH] Renames ecparams to curve to avoid confusion --- src/jsbn/ec.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/jsbn/ec.js b/src/jsbn/ec.js index 9dd1856..b2692fa 100644 --- a/src/jsbn/ec.js +++ b/src/jsbn/ec.js @@ -335,7 +335,7 @@ ECPointFp.prototype.getEncoded = function (compressed) { return enc; }; -ECPointFp.decodeFrom = function (ecparams, enc) { +ECPointFp.decodeFrom = function (curve, enc) { var type = enc[0]; var dataLen = enc.length-1; @@ -349,7 +349,7 @@ ECPointFp.decodeFrom = function (ecparams, enc) { else { var xBa = enc.slice(1), x = BigInteger.fromByteArrayUnsigned(xBa), - p = ecparams.getQ(), + p = curve.getQ(), xCubedPlus7 = x.multiply(x).multiply(x).add(new BigInteger('7')).mod(p), pPlus1Over4 = p.add(new BigInteger('1')) .divide(new BigInteger('4')), @@ -359,14 +359,9 @@ ECPointFp.decodeFrom = function (ecparams, enc) { } } - // Prepend zero byte to prevent interpretation as negative integer - - // Convert to BigIntegers - - // Return point - return new ECPointFp(ecparams, - ecparams.fromBigInteger(x), - ecparams.fromBigInteger(y)); + return new ECPointFp(curve, + curve.fromBigInteger(x), + curve.fromBigInteger(y)); }; ECPointFp.prototype.add2D = function (b) {