affine cipher
-
Upload
jose-luis-gonzalez -
Category
Documents
-
view
28 -
download
0
description
Transcript of affine cipher
Section Seven
Fall 2003Chris Christensen
Class notesAffine Ciphers
Cryptography
Combining the two processes of the Caesar cipher and the multiplicative cipher results in a transformation of the form. This is called an affine cipher.
affine (adjective): via French, from Latin ad "to, at," and finis "boundary, border," of unknown prior origin. Although the original meaning of the Latin adjective affinis was "neighboring, adjacent," the most common meaning eventually became "related by marriage." The notion of kinship or affinity was carried into French, and from there to English. In mathematics, the affine transformations include translation [and] stretching [multiplication] .
Affine transformations maintain a "kinship" between the original object and the transformed object. For example, in the plane, a pair of parallel lines is transformed into a pair of parallel lines.
The Number of Possible Keys
Now we have two parts to the key an additive part b (the shift) and a multiplicative part m (the decimation interval). As there are for Caesar ciphers, there are 26 choices for b. For each of those choices, there are (as there are for multiplicative ciphers) 12 possible choices for m. Therefore, there are possible affine ciphers. Of course, one of these does nothing the cipher with b = 0 and m = 1 yields C = P, the plaintext alphabet. This would obviously not be a good choice for encryption.
The 312 affine ciphers include the 26 Caesar ciphers (the affine ciphers with m = 1; C = P + b) and the multiplicative ciphers (the affine ciphers with b = 0, C = mP).
Here is an example of an affine cipher with additive key 5 and multiplicative key 7.
Affine cipher
Multiplicative key = 7 and additive key = 5
a112L
b219S
c326Z
d47G
e514N
f621U
g72B
h89I
i916P
j1023W
k114D
l1211K
m1318R
n1425Y
o156F
p1613M
q1720T
r181A
s198H
t2015O
u2122V
v223C
w2310J
x2417Q
y2524X
z265E
Cryptanalysis
Recognition and Cryptanalysis
Just like the multiplicative cipher, an affine cipher with decimates the alphabet but if there is also a shift. We can recognize an affine cipher from its frequency chart if we can spot a decimation and a shift.
Here is a frequency chart transformed by the affine cipher with additive key 5 and multiplicative key 7.
Frequencies
Additive key = 5 and Multiplicative key = 7
A11111111
B11
C1
D
E
F1111111
G1111
H111111
I1111
J11
K1111
L1111111
M111
N1111111111111
O111111111
P1111111
Q
R111
S1
T
U111
V111
W
X11
Y11111111
Z111
If , unlike the multiplicative cipher, ciphertext Z will not correspond to plaintext z. It is much more difficult to determine the decimation interval. Notice that in this case cipher E corresponds to plaintext z. Counting backwards from E in intervals of 7 we find
E (low)
X (low)
Q (low)
J (low)
C(low)
V(not high)
which from b = 5 and m = 7.
Another Cryptanalysis by Frequency Analysis
If we knew or had reason to suspect that we were dealing with an affine cipher, we might use the following method of cryptanalysis.
Recall that for a Caesar cipher C = P + b we need only one plaintext-ciphertext letter correspondence to determine the shift b and for a multiplicative cipher C = mP we need only one plaintext-ciphertext letter correspondence to determine the multiplier m. On way of cryptanalyzing those ciphers is to assume that the most common ciphertext letter corresponded to the plaintext e. (If that turned out to be an incorrect choice, we assumed that another high frequency plaintext letter corresponded to e, and we continued this process until the correct key was determined.)
For an affine cipher, we need to determine two keys b and m. We need two ciphertext-plaintext correspondences to do that.
Example 7.1
Here is a ciphertext
OINRF HORXH ONAPF VHLHM NZOFU OINAN GRLZI PYNJL HOINM KVBLY GMKVB SFLAG LAALY BNRNY OVHNG SXPO
and here is a frequency analysis of the ciphertext
A11111
B111
C
D
E
F1111
G1111
H111111
I1111
J1
K11
L1111111
M111
N1111111111
O11111111
P111
Q
R1111
S11
T
U1
V1111
W
X11
Y1111
Z11
Let us assume that an affine cipher was used. We need two plaintext-ciphertext correspondences. We might begin by assuming the most frequent ciphertext letter N corresponds to plaintext e and the second most frequent ciphertext letter O corresponds to plaintext t.
This would give us two equations to solve modulo 26.
If ciphertext N (C = 14) corresponds to plaintext e (P = 5), .
If ciphertext O (C = 15) corresponds to plaintext t (P = 20), .
We have a system of equations to solve modulo 26.
Here is a solution. We begin by subtracting the first congruence from the second.
m = 7. Now substitute this into one of the congruences, say the first.
b = 5.
If we were correct in our assumptions that ciphertext letter N corresponds to plaintext letter e and ciphertext letter O corresponds to plaintext letter t, then the affine cipher has additive key 5 and multiplicative key 7.
Use the key given above to decipher the ciphertext.
Brute Force
Although it would not be pleasant to do by hand (however, you might be willing to do that if the security of the free world depended upon it), it would not be hard for a computer to print out the 312 plaintext messages which result in this ciphertext. Then, we just need to find the one that makes sense.
Another Approach
We could search through the ciphertext for an enciphered version of the. Here are the 312 affine ciphers of the.
Enciphered the
Multiplicative key
Additive key
ACJ1513
ACR2315
ADJ2125
AEF1725
AGB1911
AOL17
AQH319
ASD55
AUZ717
AWV93
AXP2522
AYR1115
BDK1514
BDS2316
BEK210
BFG170
BHC1912
BPM18
BRI320
BTE56
BVA718
BXW94
BYQ2523
BZS1116
CAT1117
CEL1515
CET2317
CFL211
CGH171
CID1913
CQN19
CSJ321
CUF57
CWB719
CYX95
CZR2524
DAS2525
DBU1118
DFM1516
DFU2318
DGM212
DHI172
DJE1914
DRO110
DTK322
DVG58
DXC720
DZY96
EAZ97
EBT250
ECU1119
EGN1517
EGU2319
EHN213
EIJ173
EKF1915
ESP111
EUL323
EWH59
EYD721
FBA98
FCU251
FDW1120
FHO1518
FHW2320
FIO214
FJK174
FLG1916
FTQ112
FVM324
FXI510
FZE722
GAF723
GCB99
GDV252
GEX1121
GIP1519
GIX2321
GJP215
GKL175
GMH1917
GUR113
GWN325
GYI511
HBG724
HDC910
HEW253
HFY1122
HJQ1520
HJY2322
HKQ216
HLM176
HNI1918
HUS114
HXO30
HZK512
IAL513
ICH725
IED911
IFX254
IGZ1123
IKR1521
IKZ2323
ILR217
IMN177
IOJ1919
IWT115
IYP31
JBM514
JDI70
JFE912
JGY255
JHA1124
JLA2324
JLS1522
JMS218
JNO178
JPK1920
JXU116
JZQ32
KAR33
KCN515
KEJ71
KGF913
KHZ256
KIB1125
KMB2325
KMT1523
KNT219
KOP179
KQL1921
KYV117
LBS34
LDO516
LFK72
LHG914
LIA257
LJC110
LNC230
LNU1524
LOU2110
LPQ1710
LRM1922
LZW118
MAX119
MCT35
MEP517
MGL73
MIH915
MJB258
MKD111
MOD231
MOV1525
MPV2111
MQR1711
MSN1923
NBY120
NDU36
NFQ518
NHM74
NJI916
NKC259
NLE112
NPE232
NPW150
NQW2112
NRS1712
NTO1924
OCZ121
OEU37
OGR519
OIN75
OKJ917
OLD2510
OMF113
OQF233
OQX151
ORX2113
OST1713
OUP1925
PDA122
PFW38
PHS520
PJO76
PLK918
PME2511
PNG114
PRG234
PRY152
PSY2114
PTU1714
PVQ190
QEB123
QGX39
QIT521
QKP77
QML919
QNF2512
QOH115
QSH235
QSZ153
QTZ2115
QUV1715
QWR191
RFC124
RHY310
RJU522
RLQ78
RNM920
ROG2513
RPI116
RTA154
RTI236
RUA2116
RVW1716
RXS192
SGD125
SIZ311
SKV523
SMR79
SON921
SPH2514
SQJ117
SUB155
SUJ237
SVB2117
SWX1717
SYT193
THE10
TJA312
TLW524
TNS710
TPO922
TQI2515
TRK118
TVC156
TVK238
TWC2118
TXY1718
TZU194
UAV195
UIF11
UKB313
UMX525
UOT711
UQP923
URJ2516
USL119
UWD157
UWL239
UXD2119
UYZ1719
VBW196
VJG12
VLC314
VNY50
VPU712
VRQ924
VSK2517
VTM1110
VXE158
VXM2310
VYE2120
VZA1720
WAB1721
WCX197
WKH13
WMD315
WOZ51
WQV713
WSR925
WTL2518
WUN1111
WYF159
WYN2311
WZF2121
XAG2122
XBC1722
XDY198
XLI14
XNE316
XPA52
XRW714
XTS90
XUM2519
XVO1112
XZG1510
XZO2312
YAH1511
YAP2313
YBH2123
YCD1723
YEZ199
YMJ15
YOF317
YQB53
YSX715
YUT91
YVN2520
YWP1113
ZBI1512
ZBQ2314
ZCI2124
ZDE1724
ZFA1910
ZNK16
ZPG318
ZRC54
ZTY716
ZVU92
ZWO2521
ZXQ1114
It could be an unpleasant experience to compare one-by-one all of the trigraphs of the ciphertext against the table, but we luck out. The very first trigraph OIN appears in the table as the enciphered version of the when the multiplicative key is 7 and the additive key is 5.
Exercises
1. Construct a plaintext-ciphertext correspondence for an affine cipher with multiplicative key 11 and additive key 16.
2. Encipher the following message using an affine cipher with multiplicative key 11 and additive key 16.
The Russians and Germans also solved PURPLE.
3. Use frequency analysis to cryptanalyze the following ciphertext:
EJURB IOJMR XGEMH HUBXW TWJZM QEJUR BISUS BWQEI QVGZW NBCIV GZMJU YWUSB JWMQS WHWEB JIZGE MHHUB IOWZW JMBWM BXGJN YWUSB JWMQ
4. Search through the ciphertext in exercise 3 for an enciphered version of the. Then determine the multiplicative and additive keys and recover the plaintext.
PAGE 2
_1051514635.unknown
_1051515310.unknown
_1051617827.unknown
_1051618197.unknown
_1051515437.unknown
_1051515480.unknown
_1051515500.unknown
_1051515454.unknown
_1051515331.unknown
_1051514965.unknown
_1051515250.unknown
_1051514775.unknown
_1051511692.unknown
_1051514584.unknown
_1051511029.unknown