mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-05 08:48:14 +00:00
[CHORE] Modified functions not to overwrite entire prototype
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
sjcl.ecc.ecdsa.secretKey.prototype = {
|
sjcl.ecc.ecdsa.secretKey.prototype.sign = function(hash, paranoia) {
|
||||||
sign: function(hash, paranoia) {
|
|
||||||
var R = this._curve.r,
|
var R = this._curve.r,
|
||||||
l = R.bitLength(),
|
l = R.bitLength(),
|
||||||
k = sjcl.bn.random(R.sub(1), paranoia).add(1),
|
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);
|
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));
|
return sjcl.bitArray.concat(r.toBits(l), s.toBits(l));
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
sjcl.ecc.ecdsa.publicKey.prototype = {
|
sjcl.ecc.ecdsa.publicKey.prototype.verify = function(hash, rs) {
|
||||||
verify: function(hash, rs) {
|
|
||||||
var w = sjcl.bitArray,
|
var w = sjcl.bitArray,
|
||||||
R = this._curve.r,
|
R = this._curve.r,
|
||||||
l = R.bitLength(),
|
l = R.bitLength(),
|
||||||
@@ -26,5 +23,4 @@ sjcl.ecc.ecdsa.publicKey.prototype = {
|
|||||||
throw (new sjcl.exception.corrupt("signature didn't check out"));
|
throw (new sjcl.exception.corrupt("signature didn't check out"));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user