Previous | ToC | Next Labs: Cryptography. Part 2. Math Alive

RSA Cryptography Practice


Here we shall illustrate the encryption and decryption that was described on the previous page. Type a short sentence in the input field and then press enter; you will see the hash code in the window below it. This gives an integer representation of each character of the word. We are using a hash code with only the numbers 1 through 29 in this simple example. Letters are represented by numbers 1 through 26 independently of the case (that is 'A' and 'a' are represented by 1, and so on), space is represented by the number 27, period by 28, and all the other symbols by 29.

Pressing the Encrypt next character button will give you the encryption for each of the successive integers in the hash code, computed via the formula y = xr (mod n), where n and r are from the previous page, namely y = x25 (mod 1073). Pressing the Decrypt next character button will, on the other hand, compute ys (mod n), which in this case is y121 (mod 1073) for each of these encrypted integers; you can check that these are the original integers back again!

RSA Encryptor

Note. You may have noticed that the letter A corresponds to 1 in a hash code. Hence, it is always enctypted as 1. In real RSA systems we never encrypt letter by letter, we encrypt the large block of several letters at once. The reason we want large blocks is that encrypting letter by letter we have the same encryption for the same letter (this is called a substitution cipher), hence we can use frequency analysis to decrypt. The larger the blocks the less patterns will be kept in the result.


Previous | ToC | Next Last Modified: August 2008