Encrypt/Decrypt > 

Affine cipher - Encoder and decoder

  
Affine cipher encryption process:
1. Convert each letter in the plain text alphabet to a corresponding integer in the range of 0 to m -1;
2. Calculate the value of each letter as follows (where a and b are the keys of the password):
E(x)=(ax + b) mod m
3. Multiply the integer value of the plain text letter by a, then add b to the result, and finally we take the modulus m (that is, take the remainder when m is removed, or remove the length of the letter until it is less than The length of the number).

For example, let us encrypt the plaintext "AFFINE CIPHER" with the key a = 5, b = 8:
1. First, we must find the integer value of each letter in the plaintext alphabet (take the 26 letters in the alphabet as an example), such as:
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
2) After finding the integer values ​​of the plaintext letters, perform calculations on these values. In this example, the required calculation is (5x + 8);
3) Finally, we must ensure that all answers are calculated in mod 26 and convert the integers back to ciphertext letters.

Finally, the ciphertext obtained is "IHHWVC SWFRCP".

Previous Tool: Vigenere Cipher _Online Decoder_Online Encoder

Next Tool: Playfair Cipher decoder and encoder

Release date:2021-01-26 21:20:41    Tool source:ME2 Online Tools