RSA_numbers_factored_mp.py #10869
Unanswered
Hermann-SW
asked this question in
Libraries & Drivers
Replies: 1 comment 4 replies
-
There was a problem with MicroPython implemented "gcd()" because sympy is missing in MicroPython. Now RSA_numbers_factored validation demo runs on MicroPython as well — but it takes 3:09min instead of 1 second in Python or even in browser JavaScript. Anyway it works:
|
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I started project wrt RSA numbers in Python:
https://github.com/Hermann-SW/RSA_numbers_factored/blob/main/python/RSA_numbers_factored.py
Later I added type hints and generated documentation with lazydocs:
https://github.com/Hermann-SW/RSA_numbers_factored/blob/main/python/docs/RSA_numbers_factored.py.md
I transpiled manually to JavaScript for use in NodeJS and in the browser:
https://github.com/Hermann-SW/RSA_numbers_factored#functionality-validation-python-browser-and-nodejs-demos
Yesterday I aseked myself whether playing with up to 2048-biit RSA numbers is possible in MicroPython, and it is!
I had to get rid of sympy, itertools and typing libraries, but the rest just worked in minicom session on my RP2040:
If you are not intereested in RSA numbers, you might just want to use the simplified "isprime()" function I implemented. For numbers less than 2^81 it is definitive!
You can verifiy the number of primes up to 100000 here:
https://primes.utm.edu/howmany.html
You can find the MicroPython version here:
https://github.com/Hermann-SW/RSA_numbers_factored/blob/main/python/RSA_numbers_factored_mp.py
I uploaded it to RP2040 with ampy and then used it as shown above.
P.S:
You might ask why one should do several 100 digit arbitrary precision number arithmetic in MicroPython.
My answer would be: because you can ;-)
Beta Was this translation helpful? Give feedback.
All reactions