RSA in the Scheme
I got tired of using factorial and fibonacci as benchmarks for my research, so I threw together an implementation of the RSA public-key cryptography system in Scheme.
Automatic support for arbitrarily large numbers makes the
implementation feel more natural than an equivalent implementation in
I also learned that
gcd, used for coprimality testing,
has been a part of the Scheme standard since at least R5RS.
The short implementation is appended below.
Note: I have also created an implementation of the Fermat and Solovay-Strassen primality tests, useful for the key-generation phase of RSA.