The RSA Algorithm
The following box displays the RSA algorithm. The receiver creates two keys:-
- The numbers N & E will be the public key to be used by a sender to encrypt a message.
- The numbers N & D will be the private key to be used by the receiver to decrypt the message.
Exercise. Modify the interface to allow the message to
be a string of letters of the alphabet. [Represent each
letter of the alphabet by an integer from 1 to 26; then encrypt
the letters separately.]
- All that you need to know in the way of mathematical
- x mod y means the remainder when
x is divided by y.
- x^y means x raised to the power y.
- At present the code does not include any input validation.
For example, there is no check that the two numbers that you
enter at the beginning of the algorithm are prime and distinct.
- If the user changes the value of a field and
clicks outside the field then all dependent values below
the change are updated. [Note that this is achieved by
chaining the functions invoked by the event handlers.]
- The engine code declares and initializes the variables of
- You can extract the engine code and attach your own interface
Exercise. Repeat the preceding exercise, but represent
each block of two letters as an integer.
Further exploration of RSA:-
© 1998 D.R. Watson