Skip to content

Commit

Permalink
Make use of default operator
Browse files Browse the repository at this point in the history
  • Loading branch information
Bruno Oliveira committed Oct 2, 2013
1 parent d85a8b4 commit ac0b3fe
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions core/ecc.js
Original file line number Diff line number Diff line change
Expand Up @@ -355,23 +355,22 @@ sjcl.ecc._dh = function(cn) {

/** @constructor */
generateKeys: function(curve, paranoia, sec) {
if (curve === undefined) {
curve = 256;
}
curve = curve || 256;
paranoia = paranoia || 0;

if (typeof curve === "number") {
curve = sjcl.ecc.curves['c'+curve];
if (curve === undefined) {
throw new sjcl.exception.invalid("no such curve");
}
}
if (sec === undefined) {
var sec = sjcl.bn.random(curve.r, paranoia);
}
sec = sec || sjcl.bn.random(curve.r, paranoia);

var pub = curve.G.mult(sec);
return { pub: new sjcl.ecc[cn].publicKey(curve, pub),
sec: new sjcl.ecc[cn].secretKey(curve, sec) };
}
};
};
};

sjcl.ecc._dh("elGamal");
Expand Down

0 comments on commit ac0b3fe

Please sign in to comment.