From 83742a3f5ad6809a11dadda2cd6b2734160b14d0 Mon Sep 17 00:00:00 2001 From: Stefan Thomas Date: Sat, 18 Aug 2012 05:59:09 +0200 Subject: [PATCH] Update JSBN to 1.3. --- src/jsbn/ec.js | 5 ----- src/jsbn/jsbn.js | 2 +- src/jsbn/jsbn2.js | 0 src/jsbn/prng4.js | 0 src/jsbn/rng.js | 0 5 files changed, 1 insertion(+), 6 deletions(-) mode change 100755 => 100644 src/jsbn/ec.js mode change 100755 => 100644 src/jsbn/jsbn.js mode change 100755 => 100644 src/jsbn/jsbn2.js mode change 100755 => 100644 src/jsbn/prng4.js mode change 100755 => 100644 src/jsbn/rng.js diff --git a/src/jsbn/ec.js b/src/jsbn/ec.js old mode 100755 new mode 100644 index 0e45f05..43ded3e --- a/src/jsbn/ec.js +++ b/src/jsbn/ec.js @@ -32,9 +32,6 @@ function feFpAdd(b) { } function feFpSubtract(b) { - /*console.log("b.y (int): ", Crypto.util.bytesToHex(this.x.toByteArrayUnsigned())); - console.log("this.y (int): ", Crypto.util.bytesToHex(b.toBigInteger().toByteArrayUnsigned())); - console.log("b.y-this.y (premod): ", Crypto.util.bytesToHex(this.x.subtract(b.toBigInteger()).toByteArrayUnsigned()));*/ return new ECFieldElementFp(this.q, this.x.subtract(b.toBigInteger()).mod(this.q)); } @@ -47,7 +44,6 @@ function feFpSquare() { } function feFpDivide(b) { - //console.log("x: ", Crypto.util.bytesToHex(this.x.toByteArrayUnsigned())); return new ECFieldElementFp(this.q, this.x.multiply(b.toBigInteger().modInverse(this.q)).mod(this.q)); } @@ -125,7 +121,6 @@ function pointFpAdd(b) { // v = X2 * Z1 - X1 * Z2 var v = b.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(b.z)).mod(this.curve.q); - if(BigInteger.ZERO.equals(v)) { if(BigInteger.ZERO.equals(u)) { return this.twice(); // this == b, so double diff --git a/src/jsbn/jsbn.js b/src/jsbn/jsbn.js old mode 100755 new mode 100644 index 928cc4f..40bb9e2 --- a/src/jsbn/jsbn.js +++ b/src/jsbn/jsbn.js @@ -212,7 +212,7 @@ function bnCompareTo(a) { if(r != 0) return r; var i = this.t; r = i-a.t; - if(r != 0) return r; + if(r != 0) return (this.s<0)?-r:r; while(--i >= 0) if((r=this[i]-a[i]) != 0) return r; return 0; } diff --git a/src/jsbn/jsbn2.js b/src/jsbn/jsbn2.js old mode 100755 new mode 100644 diff --git a/src/jsbn/prng4.js b/src/jsbn/prng4.js old mode 100755 new mode 100644 diff --git a/src/jsbn/rng.js b/src/jsbn/rng.js old mode 100755 new mode 100644