@@ -294,42 +294,45 @@ static std::string generatePrimeNetJson(
294294 oss << " ,\" exponent\" :" << exponent;
295295 oss << " ,\" worktype\" :" << jsonEscape (canonWT);
296296 if (!knownFactors.empty ()) {
297- // *** TODO: this is totally wrong, "known-factors" and "factors" are two ENTIRELY separate things, and should be better stored in the PrMers data structure
298- if ((worktype == " ll" ) || (worktype == " llsafe" ) || (worktype == " prp" )) {
299- oss << " ,\" known-factors\" :[" << knownFactorStrQuoted << " ]" ;
300- } else {
301- oss << " ,\" factors\" :[" << knownFactorStrQuoted << " ]" ;
297+ // *** TODO: this is totally wrong, "known-factors" and "factors" are two ENTIRELY separate things, and should be better stored in the PrMers data structure
298+ if ((worktype == " ll" ) || (worktype == " llsafe" ) || (worktype == " prp" )) {
299+ oss << " ,\" known-factors\" :[" << knownFactorStrQuoted << " ]" ;
300+ } else {
301+ oss << " ,\" factors\" :[" << knownFactorStrQuoted << " ]" ;
302302 }
303303 }
304304 if (opts.B1 > 0 ) {
305- oss << " ,\" b1\" :" << opts.B1 ;
306- if (opts.B2 > opts.B1 ) {
307- oss << " ,\" b2\" :" << opts.B2 ;
308- }
305+ oss << " ,\" b1\" :" << opts.B1 ;
306+ if (opts.B2 > opts.B1 ) {
307+ oss << " ,\" b2\" :" << opts.B2 ;
308+ }
309309 }
310310 if ((worktype == " ll" ) || (worktype == " llsafe" ) || (worktype == " prp" )) {
311- oss << " ,\" res64\" :" << jsonEscape (res64);
311+ oss << " ,\" res64\" :" << jsonEscape (res64);
312312 if (worktype == " prp" ) {
313313 oss << " ,\" res2048\" :" << jsonEscape (res2048);
314314 oss << " ,\" residue-type\" :" << residueType;
315315 }
316- oss << " ,\" errors\" :{\" gerbicz\" :" << gerbiczError << " }" ;
316+ oss << " ,\" errors\" :{\" gerbicz\" :" << gerbiczError << " }" ;
317317 oss << " ,\" shift-count\" :0" ;
318- } else if (worktype == " ecm" ) {
319- if (opts.curves_tested_for_found > 0 ) {
320- oss << " ,\" curves\" :" << opts.curves_tested_for_found ;
321- }
318+ } else if (worktype == " ecm" ) {
319+ if (opts.curves_tested_for_found > 0 ) {
320+ oss << " ,\" curves\" :" << opts.curves_tested_for_found ;
321+ }
322322 if (opts.sigma192 ) {
323- oss << " ,\" sigma192\" :" << opts.sigma192 ; // *** TODO: not sure where this value comes from ***
323+ oss << " ,\" sigma192\" :" << opts.sigma192 ; // *** TODO: not sure where this value comes from ***
324324 }
325325 oss << " ,\" curve-type\" :" << jsonEscape (isEdw ? " Edwards" : " Montgomery" );
326326 oss << " ,\" torsion-subgroup\" :" << torsion;
327327 oss << " ,\" sigma_hex\" :" << jsonEscape (opts.sigma_hex );
328328 oss << " ,\" curve_seed\" :" << opts.curve_seed ;
329329 oss << " ,\" base_seed\" :" << opts.curve_seed ;
330- }
330+ }
331331 else if (worktype == " pm1" ) {
332- oss << " ,\" errors\" :{\" gerbicz\" :" << gerbiczError << " }" ;
332+ oss << " ,\" errors\" :{\" gerbicz\" :" << gerbiczError << " }" ;
333+ if (opts.nmax ) {
334+ oss << " ,\" crandall-nK\" :{\" n\" :" << opts.nmax << " ,\" K\" :" << opts.K << " }" ;
335+ }
333336 }
334337 if (fftLength > 0 ) oss << " ,\" fft-length\" :" << fftLength;
335338 if (!proofMd5.empty ()) {
@@ -373,16 +376,16 @@ static std::string generatePrimeNetJson(
373376 canon << " <BITLO>" << " ;" ; // bitlo (e.g. 68)
374377 canon << " <BITHI>" << " ;" ; // bithi (e.g. 75)
375378 canon << " <RANGECOMPLETE>" << " ;" ; // rangecomplete (0 or 1)
376- } else if (canonWT == " PRP-3" ) {
377- canon << toLower (res64) << " ;" ; // res64
378- canon << toLower (res2048) << " ;" ; // res2048
379- canon << " 0" << " _" // shift-count
379+ } else if (canonWT == " PRP-3" ) {
380+ canon << toLower (res64) << " ;" ; // res64
381+ canon << toLower (res2048) << " ;" ; // res2048
382+ canon << " 0" << " _" // shift-count
380383 << " 3" << " _" // prp-base
381384 << residueType << " ;" ; // residue-type
382385 } else if (canonWT == " LL" ) {
383- canon << toLower (res64) << " ;" ; // res64
384- canon << " " << " ;" ; // unused
385- canon << " 0" << " ;" ; // shift-count
386+ canon << toLower (res64) << " ;" ; // res64
387+ canon << " " << " ;" ; // unused
388+ canon << " 0" << " ;" ; // shift-count
386389 } else if (canonWT == " ECM" ) {
387390 canon << opts.B1 << " ;" ; // b1
388391 if (opts.B2 > opts.B1 ) canon << opts.B2 ; // b2
@@ -402,7 +405,10 @@ static std::string generatePrimeNetJson(
402405 canon << opts.B1 << " ;" ; // b1
403406 if (opts.B2 > opts.B1 ) canon << opts.B2 ; // b2
404407 canon << " ;" ;
405- canon << " " << " ;" ; // brent-suyama
408+ if (opts.nmax ) { // Crandall-nK
409+ canon << opts.nmax << " _" << opts.K ;
410+ }
411+ canon << " ;" ;
406412 } else if (canonWT == " PP1" ) {
407413 // *** TODO: not yet not yet implemented ***
408414 canon << opts.B1 << " ;" ; // b1
@@ -451,9 +457,9 @@ std::string JsonBuilder::generate(const CliOptions& opts,
451457
452458 std::string status;
453459 if ((opts.mode == " ll" ) || (opts.mode == " llsafe" ) || (opts.mode == " prp" )) {
454- status = (isPrime ? " P" : " C" );
460+ status = (isPrime ? " P" : " C" );
455461 } else {
456- status = (!opts.knownFactors .empty () ? " F" : " NF" );
462+ status = (!opts.knownFactors .empty () ? " F" : " NF" );
457463 }
458464 int residueType = opts.knownFactors .empty () ? 1 : 5 ;
459465 return generatePrimeNetJson (
0 commit comments