In the January 15th session of Future Science Leaders, we learned about affine ciphers. Affine ciphers are a simple example of encryption that can be easily deciphered by computers.

Affine ciphers work by first converting each letter to its numerical value. This array of numeric values is then transformed using the function (ax + b) mod 26. Lastly, each of the transformed numeric values is converted back into a letter. Here is an encryption algorithm that I created in Java using affine ciphers.

To decrypt an affine cipher one must go through the steps of encrypting using an affine cipher in reverse. Hence, the first step is to convert the encrypted letters into their equivalent numeric values. Next, we must reverse the function (ax + b) mod 26. As the last transformation that we completed was (+ b mod 26), the first step in decryption is using (- b) mod 26. The next step that we must reverse was the modular multiplication (ax) mod 26. To reverse this we will use modular division. Here is a simple modular division algorithm that I created in Java.

The final step of our decryption is converting the numeric values back into letters. If we started with the correct a, b, and encrypted value we should be left with our unencrypted message. Below is a decryption algorithm for an affine cipher that I have created.

## Leave a Reply