How the Encryptor works

There are many ways to encrypt a message. The Encryptor uses a cycling cryptogram. This involves the use of a single numerical key for encoding and decoding a message. It uses the ascii value of each letter in the message and adds the value of the corresponding digit in the key. To decrypt the message, the value is subtracted. Here is an example using the 6 digit key 432415:
    H e l l o   t h i s   i s   a   t e s t
  + 4 3 2 4 1 5 4 3 2 4 1 5 4 3 2 4 1 5 4 3
    L h n p p % x k k w ! n w # c $ u j w v 
The key is repeated over and over again to encode the message. If a letter such as Z is reached, it is cycled back to A. The ascii value of a space is 32. Add ing 5 to 32 yields 37, which is the ascii value of %.

  • An advantage of this system is that there is no overabundance of any one character in the message. For example, every time there is an "e," the most common letter in the english language, there is a different number corresponding to it.
  • A disadvantage to this is that the most a number can vary from its original value is by 10 units. For characters such as spaces, which are farther away than letters, a different character is seen, such as a % $. Capital letters are also obvious in the code. The cure would be to use a number system besides base 10. If we used hexadecimal, then the code could be as much as 16 units away. The Encryptor uses an array of numbers instead of a numerical number. With this system, a code can be as far as 50 units away from its original value, almost completely obscuring the text!
  • The key is a unique number that is created from the password that you enter. The password is used to calculate a seed value for the random number generator. The random number generator then used as a random seed to randomly generate the 40 digits of the key. The keys "digits" are stored in a 40 element array.

    View the C source code for the Encryptor

    RSA Encryption

    The Riverst, Shamir, and Adleman public key system is another way to encrypt a message. This is probably the most secure system to date for encryption. The reason it is so secure is because of the sheer wall of mathematics and computational power it would require to directly decrypt the message without the key.

    The RSA system involves the use of two keys instead of one. One key is used to encrypt a message and the other is used to decrypt the message. You cannot decrypt a message with the same key you used to encrypt it. One key can be used as the encryptor key, and it can be made public. The other key is used to decrypt and it is kept private.

    The reason that the two keys work together is that they are mathematically linked. One key undoes what the other has done, similar to the way that division undoes multiplication. Here is the way that they are linked:

    To encrypt a message, take the original code, raise it to the power of the Encrypt Key (E), and take the remainder when it is divided by a special number called the Modulus.

    To decrypt a message, take the encrypted code, raise it to the power of the Decrypt Key (D), and take the remainder when it is divided by a special number called the Modulus.

    modis the modulo function. It is like division, except it is using the remainder. For example 146 mod 12 = 2, because 146/12 = 12 remainder 2. The modulo function is useful for many purposes in encryption because of its periodic, or repeating nature. N is a large prime number used as the modulus in the formula

    How N, E, and D are calculated

    These 3 numbers are all generated by 2 large prime numbers, P and Q which are chosen randomly. These 2 numbers are what relate N, E and D. N is simply the product of P and Q.

    E and D are related to P and Q by the following equation:

    As you can see, this means that there are many possible values for E and D that will solve this equation. A value for E is picked randomly, and then the equation is solved for D.

    Once the values have been calculated, P and Q are then discarded. It is very important to do this, because D can easily be calculated from E if P and Q are known. But if N is really P*Q, doesn't that mean that you can find P and Q? The answer is that in order for a cracker to find P and Q from N, they must factor N. Because N is such a huge number, it is would take such an extreme amount of computing power to factor it, that it is practically impossible.

    More information about RSA Encryption and Pretty Good Privacy (PGP)

    Modular Arithmetic and mathematical definitions.
    How RSA Works
    The Cryptography and PGP home page
    The International PGP Home Page
    Back to Main Page