diff --git a/core/bn.js b/core/bn.js index d7b9d16..7d5dc31 100644 --- a/core/bn.js +++ b/core/bn.js @@ -318,8 +318,8 @@ sjcl.bn.prototype = { toBits: function(len) { this.fullReduce(); len = len || this.exponent || this.limbs.length * this.radix; - var i = Math.floor((len-1)/24), w=sjcl.bitArray, e = (len + 7 & -8) % this.radix || this.radix; - out = [w.partial(e, this.getLimb(i))]; + var i = Math.floor((len-1)/24), w=sjcl.bitArray, e = (len + 7 & -8) % this.radix || this.radix, + out = [w.partial(e, this.getLimb(i))]; for (i--; i >= 0; i--) { out = w.concat(out, [w.partial(this.radix, this.getLimb(i))]); } diff --git a/core/ecc.js b/core/ecc.js index 9e456d0..f392608 100644 --- a/core/ecc.js +++ b/core/ecc.js @@ -346,9 +346,9 @@ sjcl.ecc.elGamal.secretKey.prototype = { } }; -sjcl.ecc._dh("dsa"); +sjcl.ecc._dh("ecdsa"); -sjcl.ecc.dsa.secretKey.prototype = { +sjcl.ecc.ecdsa.secretKey.prototype = { sign: function(hash, paranoia) { var R = this._curve.r, l = R.bitLength(), @@ -359,7 +359,7 @@ sjcl.ecc.dsa.secretKey.prototype = { } }; -sjcl.ecc.dsa.publicKey.prototype = { +sjcl.ecc.ecdsa.publicKey.prototype = { verify: function(hash, rs) { var w = sjcl.bitArray, R = this._curve.r, diff --git a/sjcl.js b/sjcl.js index 6141fbf..239515b 100644 --- a/sjcl.js +++ b/sjcl.js @@ -44,7 +44,7 @@ d[b].toString(16);b=0;b--)out=c.concat(out,[c.partial(this.radix,this.getLimb(b))]);return out},bitLength:function(){this.fullReduce();for(var a=this.radix*(this.limbs.length-1),b=this.limbs[this.limbs.length- +0,b,c=this.ipv,d,e=this.limbs,f=e.length,g=this.radixMask;for(b=0;b=0;b--)a=c.concat(a,[c.partial(this.radix,this.getLimb(b))]);return a},bitLength:function(){this.fullReduce();for(var a=this.radix*(this.limbs.length-1),b=this.limbs[this.limbs.length- 1];b;b>>=1)a++;return a+7&-8}};sjcl.bn.fromBits=function(a){var b=new this,c=[],d=sjcl.bitArray,e=this.prototype,f=Math.min(this.bitLength||0x100000000,d.bitLength(a)),g=f%e.radix||e.radix;for(c[0]=d.extract(a,0,g);gn;){j=l.pop();r=l.length;for(h=0;h