[CHORE] Modified functions not to overwrite entire prototype

This commit is contained in:
Evan Schwartz
2014-04-23 10:59:15 -07:00
parent 7f59fb917c
commit 8275e036c9

View File

@@ -1,5 +1,4 @@
sjcl.ecc.ecdsa.secretKey.prototype = {
sign: function(hash, paranoia) {
sjcl.ecc.ecdsa.secretKey.prototype.sign = function(hash, paranoia) {
var R = this._curve.r,
l = R.bitLength(),
k = sjcl.bn.random(R.sub(1), paranoia).add(1),
@@ -7,11 +6,9 @@ sjcl.ecc.ecdsa.secretKey.prototype = {
s = sjcl.bn.fromBits(hash).add(r.mul(this._exponent)).mul(k.inverseMod(R)).mod(R);
return sjcl.bitArray.concat(r.toBits(l), s.toBits(l));
}
};
sjcl.ecc.ecdsa.publicKey.prototype = {
verify: function(hash, rs) {
sjcl.ecc.ecdsa.publicKey.prototype.verify = function(hash, rs) {
var w = sjcl.bitArray,
R = this._curve.r,
l = R.bitLength(),
@@ -26,5 +23,4 @@ sjcl.ecc.ecdsa.publicKey.prototype = {
throw (new sjcl.exception.corrupt("signature didn't check out"));
}
return true;
}
};