RSA implementation by Tom Chiari

Bob wants to send a message to Alice. His message is "42" which is my age and
the answer to Life, the Universe and Everything.
Alice chooses two "large" primes p and q : 7 and 13, which means:
N  pq  7 13  91
(N)  ( p 1)(q 1)  6 12  72
Alice has to choose e and d so that ed  1mod (N ) . She chooses:
d  29
these numbers work because ed  1 is divisible by 72
She makes public:
N  91
She keeps private:
q  13
(N)  72
d  29
To encrypt his message  , he computes:
e mod N  42 e mod 91  130,691,232mod91  35
let Y  35
he sends the message Y in public channels to Alice
Alice receives the message Y and computes:
Y d mod N  3529 mod91  5.997541837...10 44  42
so Alice has received Bob’s message
Observations and Questions:
* choosing p and q was easy b/c they were tiny, but choosing e and d was much
harder. On my first few tries, e or d ended up being the same as p or q which
probably isn’t good OR I got e  d , which I assume is also not a good thing.
* Since e is public, how does she know the message is from Bob? Should he include
a signature at the beginning or end of every message? probably a good idea.
* When Alice is decrypting, the numbers got very large and my calculator can’t do
modular math, so I had to find an online program that would do it for me. If folks in
the real world are dealing with 200 digit numbers and they need every decimal
place to be accurate, how do they accomplish this quickly?
* After playing with this for a bit, I realized that I couldn’t send a message whose
‘value’ was larger than N  91 , so I tried all of this again with larger primes.
I started by googling a list of all primes up to 10,000 and picked two of them:
p  7919 and q  7481 . This gave me:
N  59,242,039 and
(N )  59,226,640
Finding e and d then became much harder, so I created an Excel spreadsheet to help
me by looking for divisors of 2(N )  1 or 118,453,281 . I came up with two choices
for e and d relatively quickly and settled on:
e  381 and
d  310,901
I then used this set of values to encrypt the message MATH (13,012,008: M=13,
A=01 etc), which I sent to Alice, who decrypted it just fine. Pretty cool.
I used the modular arithmetic calculator on to carry out the
A final observation is that if Eve intercepts my encrypted message (which, by the
way is 31,299,770 ), would she have a fairly hard time decrypting it because she
doesn’t know the decryptor exponent d ? She does know the modulus, so I guess she
could try different values of d with the public modulus N . A speedy computer
could probably handle this quickly, but I can now see that if the original primes are
200 digits or so long, how a supercomputer doing trillions of calculations a second
would have a hard time. Also, I suppose you could add an additional layer of security
by first encrypting the message with a Ceasar (or some other) cipher before