File tree 1 file changed +6
-7
lines changed
1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -355,23 +355,22 @@ sjcl.ecc._dh = function(cn) {
355
355
356
356
/** @constructor */
357
357
generateKeys : function ( curve , paranoia , sec ) {
358
- if ( curve === undefined ) {
359
- curve = 256 ;
360
- }
358
+ curve = curve || 256 ;
359
+ paranoia = paranoia || 0 ;
360
+
361
361
if ( typeof curve === "number" ) {
362
362
curve = sjcl . ecc . curves [ 'c' + curve ] ;
363
363
if ( curve === undefined ) {
364
364
throw new sjcl . exception . invalid ( "no such curve" ) ;
365
365
}
366
366
}
367
- if ( sec === undefined ) {
368
- var sec = sjcl . bn . random ( curve . r , paranoia ) ;
369
- }
367
+ sec = sec || sjcl . bn . random ( curve . r , paranoia ) ;
368
+
370
369
var pub = curve . G . mult ( sec ) ;
371
370
return { pub : new sjcl . ecc [ cn ] . publicKey ( curve , pub ) ,
372
371
sec : new sjcl . ecc [ cn ] . secretKey ( curve , sec ) } ;
373
372
}
374
- } ;
373
+ } ;
375
374
} ;
376
375
377
376
sjcl . ecc . _dh ( "elGamal" ) ;
You can’t perform that action at this time.
0 commit comments