Professional Documents
Culture Documents
A3 - Shift Mapping and Affine Mapping
A3 - Shift Mapping and Affine Mapping
xn
Function
Ciphertext
function for
letter x
Cn
n+1
Encryptions of hello:
Shift mapping with a = 13: uryyb
Affine mapping with b = 5, c = 3 (Blue): mxggv
Affine map with b = 7, c = 11 (Green): inkkf
Affine Mapping
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
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
CIPHER
Conditions:
b is coprime to 26 for uniqueness
it is redundant to have c > 25
Statistical attack
For affine and shift maps, the parameters of the encryption function can often be inferred by
looking at how frequently letters appear in the message. This helps to slim down the
possibilities by matching letters. Modular arithmetic can then be used to deduce the parameter
keys (a, b or c).
E.g. The letter E statistically in the English language. If the letter A appears most in a message
then it is plausible to assume A = E. Hence a = 4.
15 * (inverse of 3) = b
b= 15*9 mod 26 = 5
c = 20
Yes
0
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
B C D E
G H
M N O P
Q R
S T
U V W X Y
a =0
Recognisable
output?
trial a,b
No
Z
a+1
given
information:
C = E,
F=T