File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
Expand file tree Collapse file tree 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) {
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
377376sjcl . ecc . _dh ( "elGamal" ) ;
You can’t perform that action at this time.
0 commit comments