Skip to content

Commit ac0b3fe

Browse files
author
Bruno Oliveira
committed
Make use of default operator
1 parent d85a8b4 commit ac0b3fe

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

core/ecc.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -355,23 +355,22 @@ sjcl.ecc._dh = function(cn) {
355355

356356
/** @constructor */
357357
generateKeys: function(curve, paranoia, sec) {
358-
if (curve === undefined) {
359-
curve = 256;
360-
}
358+
curve = curve || 256;
359+
paranoia = paranoia || 0;
360+
361361
if (typeof curve === "number") {
362362
curve = sjcl.ecc.curves['c'+curve];
363363
if (curve === undefined) {
364364
throw new sjcl.exception.invalid("no such curve");
365365
}
366366
}
367-
if (sec === undefined) {
368-
var sec = sjcl.bn.random(curve.r, paranoia);
369-
}
367+
sec = sec || sjcl.bn.random(curve.r, paranoia);
368+
370369
var pub = curve.G.mult(sec);
371370
return { pub: new sjcl.ecc[cn].publicKey(curve, pub),
372371
sec: new sjcl.ecc[cn].secretKey(curve, sec) };
373372
}
374-
};
373+
};
375374
};
376375

377376
sjcl.ecc._dh("elGamal");

0 commit comments

Comments
 (0)