From 7451c54cc6d612c803887bb0486a02576947b7cd Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Sat, 5 Apr 2014 06:27:33 +1100 Subject: [PATCH] Removes curveFpDecodePointHex --- src/jsbn/ec.js | 26 -------------------------- src/jsbn/sec.js | 2 +- 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/src/jsbn/ec.js b/src/jsbn/ec.js index a7642e8..9dd1856 100644 --- a/src/jsbn/ec.js +++ b/src/jsbn/ec.js @@ -283,38 +283,12 @@ function curveFpFromBigInteger(x) { return new ECFieldElementFp(this.q, x); } -// for now, work with hex strings because they're easier in JS -function curveFpDecodePointHex(s) { - switch(parseInt(s.substr(0,2), 16)) { // first byte - case 0: - return this.infinity; - case 2: - case 3: - // point compression not supported yet - return null; - case 4: - case 6: - case 7: - var len = (s.length - 2) / 2; - var xHex = s.substr(2, len); - var yHex = s.substr(len+2, len); - - return new ECPointFp(this, - this.fromBigInteger(new BigInteger(xHex, 16)), - this.fromBigInteger(new BigInteger(yHex, 16))); - - default: // unsupported - return null; - } -} - ECCurveFp.prototype.getQ = curveFpGetQ; ECCurveFp.prototype.getA = curveFpGetA; ECCurveFp.prototype.getB = curveFpGetB; ECCurveFp.prototype.equals = curveFpEquals; ECCurveFp.prototype.getInfinity = curveFpGetInfinity; ECCurveFp.prototype.fromBigInteger = curveFpFromBigInteger; -ECCurveFp.prototype.decodePointHex = curveFpDecodePointHex; // prepends 0 if bytes < len // cuts off start if bytes > len diff --git a/src/jsbn/sec.js b/src/jsbn/sec.js index 5ae8d11..3dee7e2 100644 --- a/src/jsbn/sec.js +++ b/src/jsbn/sec.js @@ -185,7 +185,7 @@ function secp256r1() { var curve = new ECCurveFp(p, a, b); var x = fromHex("6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296") - var y = fromHex("4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5") + var y = fromHex("4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5") var G = new ECPointFp(curve, curve.fromBigInteger(x), curve.fromBigInteger(y))