Bill Allombert on Sat, 02 Nov 2024 14:43:01 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: Using Python with PARI/GP questions |
On Sat, Nov 02, 2024 at 07:48:16AM +0100, hermann@stamm-wilbrandt.de wrote: > Five days ago I published my first challenge with price money (100 USD): > https://github.com/Hermann-SW/RSA_numbers_factored/tree/main/1_sum_of_2_sqs_semiprime > > To make it impossible for me to know the random seed used, > I used Python time.time_ns(), epoch time at nanosecond resolution. > > To make it impossible for everyone else, I did input a long > factor with stdiomask.getpass() that was used as well. > > pi@raspberrypi5:~/RSA_numbers_factored/1_sum_of_2_sqs_semiprime $ > ./challenge.py > factor: **************************************************** > 1 > 1 > 4675966568241743081873479921415404781226665419569548210315782648657034701192057386949090276633929520980704940531187630512099300307 > 15512340356624619735725710103759797813121190798562361321728468720849205060936899989010233224533248153329173333001037083787589728422 > 262497366687079298365523922947227261835640624571224693166902778465021817904092516082216927109476590103573107044406347695971527079161864485154522005142837118124732638711372016122621735436807398062028290119971297328351792353815685809546983240652624562758684904333 > 261 decimal digits semiprime > pi@raspberrypi5:~/RSA_numbers_factored/1_sum_of_2_sqs_semiprime $ > > > Questions: > > A) > GP has (clear text) input(). Is GP equivalent of Python stdiomask.getpass() > that outputs asterisks instead of typed characters available? Well, you can do this system("stty -echo");pass=input();system("stty echo"); > B) > getabstime/gettime/getwalltime return milliseconds. Is there a GP option > with more resolution like Python time.time_ns? No, though internally pari_timer stores microsecond, so in C you can get microsecond. > C) > If having to use Python for asterisk input with PARI/GP for computation, > what is better? > 1) call PARI/GP script from Python with os.system() and pass information via > environment variable (which I did) > 2) call Python using extern() or externstr() from PARI/GP I would say it depends on your security profile. Cheers, Bill