Merge pull request #130 from dcousens/eccurverename

Renames ecparams to curve to avoid confusion
This commit is contained in:
Wei Lu 2014-04-16 19:53:39 +08:00
commit ed28c6adcf

View file

@ -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) {