What is the affine cipher?
The affine cipher is a type of monoalphabetic substitution cipher. In the affine cipher, each letter of the plaintext is substituted with another letter from the alphabet. So, the affine cipher is a type of substitution cipher. And, in the affine cipher, a fixed letter from plaintext is always substituted with some other fixed letter from the alphabet. So, the affine cipher is a type of monoalphabetic substitution cipher.
In the affine cipher, all letters of the alphabet are first numbered from 0 to (symbol size – 1). Then, each letter from plaintext is substituted as per the following encryption function:
E(x) = (ax + b) mod symbol size
a and b are two key components of the encryption key. a and b are integers. But, they cannot be any integers. The key components should have the following properties:
gcd(a, symbol size) = 1 b < symbol size
The encryption key can also be written as:
Encryption Key = a * symbol size + b
For example, if the symbol size is 26, a is 7 and b is 2, then the encryption key can be written as:
Encryption Key = 7 * 26 + 2 = 184
Please note that gcd(7, 26) = 1 and b = 7 < 26 The key components can be obtained from the encryption key as follows:
a = key // symbol size b = key % symbol size where ‘//’ is the floor division operation
In the affine cipher, the decryption key is different from the encryption key. The decryption key …
0 Comments