Using the IC to break the Vigenere cipher
by fortenforge, Nov 27, 2009, 11:16 PM
So we have this ciphertext:
HQCNPXQNRHPRPGJPLOGQEVSIEILNOVQVSQTPCVUDLOGMPGZJPMNVLRFBFGZJ
HZFIHSQTFHMEVIEFESPOLGZJFWXCOHGZJHZVMIEFMPKVUYZVOAJVTRITZBLV
FACGREPLFYWIVANKYKHWICNLCZDQQTQEVTQYNBIQFFNMCKVICPVNWFTWKJMS
KTRPOFWJSNP
We want to find the key length, once we know that we can split the text into that many sections and preform frequency analysis on each of them to find the key. Now instead of finding repeated sequences, we first stack the ciphertext into columns:
HQ
CN
PX
QN
RH
PR
PG
JP
LO
GQ
EV
SI
EI
LN
OV
QV
SQ
TP
CV
UD
LO
GM
PG
ZJ
PM
NV
LR
FB
FG
ZJ
HZ
FI
HS
QT
FH
ME
VI
EF
ES
PO
LG
ZJ
FW
XC
OH
GZ
JH
ZV
MI
EF
MP
KV
UY
ZV
OA
JV
TR
IT
ZB
LV
FA
CG
RE
PL
FY
WI
VA
NK
YK
HW
IC
NL
CZ
DQ
QT
QE
VT
QY
NB
IQ
FF
NM
CK
VI
CP
VN
WF
TW
KJ
MS
KT
RP
OF
WJ
SN
P
Then we find the average of the IC's of each of the columns, if the IC is close to what the IC is of normal English text (0.067) then the key length is that number of columns. This is very intuitive because, if we have found the correct number of columns, each column would have an IC like that of a caesar cipher and the IC of a caesar cipher will always be the same as the average IC for english because the frequencies of the letters are just being shuffled around.
In this case it turns out that the number of columns is 6.
The ciphertext can then be decrypted to FILLETOFAFENNYSNAKEINTHECAULDRONBOILANDBAKEEYEOFNEWTANDTOEOF
FROGWOOLOFBATANDTONGUEOFDOGADDERSFORKANDBLINDWORMSSTINGLIZAR
DSLEGANDOWLETSWINGFORACHARMOFPOWERFULTROUBLELIKEAHELLBROTHBO
ILANDBUBBLE.
HQCNPXQNRHPRPGJPLOGQEVSIEILNOVQVSQTPCVUDLOGMPGZJPMNVLRFBFGZJ
HZFIHSQTFHMEVIEFESPOLGZJFWXCOHGZJHZVMIEFMPKVUYZVOAJVTRITZBLV
FACGREPLFYWIVANKYKHWICNLCZDQQTQEVTQYNBIQFFNMCKVICPVNWFTWKJMS
KTRPOFWJSNP
We want to find the key length, once we know that we can split the text into that many sections and preform frequency analysis on each of them to find the key. Now instead of finding repeated sequences, we first stack the ciphertext into columns:
HQ
CN
PX
QN
RH
PR
PG
JP
LO
GQ
EV
SI
EI
LN
OV
QV
SQ
TP
CV
UD
LO
GM
PG
ZJ
PM
NV
LR
FB
FG
ZJ
HZ
FI
HS
QT
FH
ME
VI
EF
ES
PO
LG
ZJ
FW
XC
OH
GZ
JH
ZV
MI
EF
MP
KV
UY
ZV
OA
JV
TR
IT
ZB
LV
FA
CG
RE
PL
FY
WI
VA
NK
YK
HW
IC
NL
CZ
DQ
QT
QE
VT
QY
NB
IQ
FF
NM
CK
VI
CP
VN
WF
TW
KJ
MS
KT
RP
OF
WJ
SN
P
Then we find the average of the IC's of each of the columns, if the IC is close to what the IC is of normal English text (0.067) then the key length is that number of columns. This is very intuitive because, if we have found the correct number of columns, each column would have an IC like that of a caesar cipher and the IC of a caesar cipher will always be the same as the average IC for english because the frequencies of the letters are just being shuffled around.
In this case it turns out that the number of columns is 6.
The ciphertext can then be decrypted to FILLETOFAFENNYSNAKEINTHECAULDRONBOILANDBAKEEYEOFNEWTANDTOEOF
FROGWOOLOFBATANDTONGUEOFDOGADDERSFORKANDBLINDWORMSSTINGLIZAR
DSLEGANDOWLETSWINGFORACHARMOFPOWERFULTROUBLELIKEAHELLBROTHBO
ILANDBUBBLE.