This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Not graceful, but functional



>What *is* this?  Some sort of export-a-crypto-sig in Scheme?

Yep!

An RSA public key is two numbers: an exponent and a modulus.  The
private key is a different exponent, and the same modulus.  You give
the Guile script the public exponent and the modulus as command-line
arguments, and a stream of numbers as input, and it encrypts them.  If
you give it the private exponent and the modulus as command-line
arguments, and feed it the encrypted stream, you get the original
stream back.

RSA is pretty because encryption and decryption are so similar; you
can do them both with the same scheme script.  I wanted to make the
script operate on arbitrary byte streams, but for obscure but solid
reasons, this would require the use of separate encryption and
decryption programs, so I decided to present it as is.

However, this certainly fits the Scheme stereotype: "I've given you
the theoretical foundation; what do you care about whether it's
usable?"  So if someone can come up with a .signature-sized bytestream
RSA, even encryption-only, that would be cool.

The point is simply that Guile's bignums make RSA pretty easy.  We
have an inefficient implementation in two lines, and a decent one in
four.