- Introduction
- RSA_numbers_factored.py documentation
- Non-standard Python environments
- Functionality validation:
- Multiple precision integer performance across languages
Associated forum thread:
https://forums.raspberrypi.com/viewtopic.php?t=343468
Continuation of RSA_numbers_factored.py gist (now in ./RSA_numbers_factored.py). Python code changes get manually transpiled to ../RSA_numbers_factored.js for use in nodejs and HTML demos, find details here (with added JavaScript implementation of sympy functions gcd and isprime, and functions from itertools).
With v1.10 this repo is formatted with Python code formatter black, and pylinted.
Here shown for demo RSA_svg.py to create SVG from a RSA number:
Different to OpenSSL random art, the generated image exposes RSA number factor p (1-bits = shown rows) and factor q (1-bits = shown columns) with "and" function:
$ python RSA_svg.py 250 > 250.svg
$ convert 250.svg 250.svg.png
$ file 250.svg.png
250.svg.png: PNG image data, 414 x 415, 2-bit colormap, non-interlaced
$
Makefile targets:
$ make
targets: doc|doc_diff|pylint|black|validate|clean
$
- doc: runs lazydocs to create new doc, with some sed replacements
- doc_diff: updates doc, and shows reduced version of
git diff
for doc - pylint: runs pylint, allows long lines with 92+ continuous digits, ignores no-self-use and invalid-name warnings
- black: runs "black" Python formatter, followed from
make validate
- validate: compares validation run output against file "validate.good"
- clean: remove doc and temporary file
Generated with lazydocs, can be found here:
docs/RSA_numbers_factored.py.md
Updated with make doc
.
Not up to date version with emulation of used sympy functionality RSA_numbers_factored_mp.py does run on MicroPython on a 264KB ram only Raspberry Pico RP2040 microcontrolller (just for fun — "Validation demo takes 3:09min on RP2040 MicroPython, instead of 1 second in Python or browser JavaScript version though ..."). More details in this forum posting
Unmodified RSA_numbers_factored.py works on Android (with Pydroid3 playstore app, 3 day free trial, 2$/month, 16$/lifetime) as well. Test __name__ == "__main__" does not work in Pydroid3, so new demo Pydroid3_demo.py added. Details in this forum posting