Professional Documents
Culture Documents
Contd
11/30/2022 1
The Affine Cipher
11/30/2022 2
Example: The Affine Cipher
11/30/2022 3
Decryption
Since K=(7,3), We can calculate 7-1 mod 26=15, the corresponding decryption
function is
dk(y)= 15 (y-3) mod 26
dk(y)= 15 (0-3) mod 26
dk(y)= -45 mod 26
dk(y)= -19 = 7
11/30/2022 4
Few More Inverses
For decryption function, For decryption function, one requires to
one requires to compute compute inverse a (a-1):
inverse a (a-1):
6-1 mod 17
3-1 ◦ 3
◦ 9
18-1 mod 19
5-1 ◦ 18
◦ 21
17-1 mod 26
7-1 ◦ 23
◦ 15
12-1 mod 23
11-1 ◦ 2
◦ 19
11/30/2022 5
The Affine Cipher
This congruence has a unique solution for every y if and only if gcd(a, 26) = 1
WHY??
The values of aZ 26 such that gcd(a, 26) = 1 are
a = 1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, and 25.
The parameter b can be any element in Z26 .
In order that decryption is possible, we want that the congruence: ax b y (mod 26)
has a unique solution for y
Hence the Affine Cipher has how many possible keys (keyspace)
12 × 26 = 312 possible keys.
11/30/2022 6
Cryptanalysis of the Affine Cipher
Consider the Ciphertext:
Hypothesis 1
R is encryption of e eK(4) = 17
D is encryption of t eK(19) = 3
11/30/2022 7
Cryptanalysis of the Affine Cipher
Frequency occurrences of each letter
R D E,H,K F,V P,S A,L,M,U,X B,N,O,Y C,G,I,J,Q,T,W,Z
8 6 5 4 3 2 1 0 57
Hypothesis 1
R is encryption of e eK(4) = 17
D is encryption of t eK(19) = 3
Recall that , ek(x)=a*x + b, thus
4a + b=17 a=6 in Z26
19a + b=3 b=19
Hypothesis 2
R is encryption of e eK(4) = 17
E is encryption of t eK(19) = 4
11/30/2022 9
Cryptanalysis of the Affine Cipher
Hypothesis 2
R is encryption of e eK(4) = 17
E is encryption of t eK(19) = 4
Recall that , ek(x)=a*x + b, thus
4a + b=17 a=13 in Z26
19a + b=4 b=17
Hypothesis 3
R is encryption of e eK(4) = 17
H is encryption of t eK(19) = 7
11/30/2022 11
Cryptanalysis of the Affine Cipher
Hypothesis 3
R is encryption of e eK(4) = 17
H is encryption of t eK(19) = 7
Recall that , ek(x)=a*x + b, thus
4a + b=17 a=8 in Z26
19a + b=7 b=11
Hypothesis 4
R is encryption of e eK(4) = 17
K is encryption of t eK(19) = 10
11/30/2022 13
Cryptanalysis of the Affine Cipher
11/30/2022 14
Cryptanalysis of the Affine Cipher
Verify:
The ciphertext is:
ALGORITHMSAREQUITEGENERALDEFINITIONSOFARITHMETICPROCESSES
11/30/2022 15