[Back] Kasiski examination focuses on determining the key size for a polyalphabetic substitution ciphers using keywords (such as for Vigenère cipher). With the keyword length, the ciphertext is lined in n columns (where n is the keyword length). Each column is then defined with a monoalphabetic substitution cipher, and where frequency analysis can be used to crack the key.
The Kasiski examination looks for repeated strings of characters in the ciphertext, and where these strings are three characters or more characters long. Overall the distances between these occurrences are then used to be multiples of the keyword length of the keyword. In the following the first value is the best quess:
The following are Vigenère ciphers:
- One character key (key="b"): . Try
- Two character key (key="bc"): . Try
- One character key (key="f"): . Try
- Two character key (key="az"): . Try
- Three character key (key="bcd"): . Try
- Four character key (key="oval"): . Try
- Four character key (key="help"): . Try
- Five character key (key="hello"): . Try
- Seven character key (key="encrypt"): . Try
If we have a message of:
and then use a key of "abc", we get:
theywillnotkeeptheburningdeck abcabcabcabcabcabcabcabcabcab TIGYXKLMPOUMEFRTIGBVTNJPGEGCL
We can see that the "the" word has aligned to the key:
the ywillnotkeep the burningdeck abc abcabcabcabc abc abcabcabcab TIG YXKLMPOUMEFR TIG BVTNJPGEGCL
So we could reason that they have a key size of three.
It was Major Friedrich Wilhelm Kasiski, a German infantry officer and was involved in breaking ciphers, who first defined a method for attacking polyalphabetic substitution ciphers. Kasiski was born in Schlochau, Kingdom of Prussia (now Człuchów, Poland), and from 1860 and 1868 he was a commander of the National Guard battalion.
In 1863, he published a 95-page book on cryptography:
Die Geheimschriften und die Dechiffrir-Kunst "Secret writing and the Art of Deciphering"
It's main focus was on the Vigenère cipher, which was seen as secure at the time. It focused on analysing gaps between repeated ciphertext fragments, in order to get a hint on the key length - Kasiski examination. The method eventually revolutised crytography.
With Kasiski examination, we take the cipher message:
JP FICSUGU 1 UJH DQQDGSU QI EGIFPFF-KQ-EGSUJ ZBU GJUFVUVFF, ZIGUF C GFHHOEH TAVUGP ICV NCQZ NDZGUT QI EGIFPFF. WQGQUUWQBVHMA, DT KQ NKOJVDSA VZUWFOV, JV LT PRU COXCBT RRTULCNH UQ SSQWFEW VULOI ISQQU-NLOG GFHHOEHT, GYFP LG VKFTH BTH NWOUKSMG OBAHSU RG VKFO, DHCLOUW CTHBEKFU LO UHDWUJVB (GKJVTH 2.2). UJLT EDO DH CGFBWVF CQ JPWSWGFT KBU IPWQE C ZFCNOGVT YLUJLO VKF UHDWUJVB CCUSKHSU, RS DHDCXTG WIG LOVUVFHS JDT CFUWDMNB NCQBIHE VR QJBTKFBNOZ NRDCWF VKFOVFNYFU ZJVKJP WIG WSWVUGG BTHBU. WIWV BNO UJH HCWFYDZ HLSGZBNOT CQE FPA’U FBPQPV SSQWFEW BIDJPVU CQ JPWSWGFT ROEH UJHZ JDWG PBPDHGG UQ EBUH UJHNUHMXHT RKZULDCOMA RS NRDCOMA ZJVKJP D OGWXQUL. COPPJ XKWI VKJU, PPUW TGFVTLUA VZUWFOV DCQ PPOZ IXBTG BIDJPVU MQPYQ UASFU RG CWUCFLU, VVEK BU LO FHUGFUKQH MQPYQ WKUVUHT. C SBTWJEXMCU QTRCNHN KV XJHO PHX VBQGV PH DUVDDMV PEFVT, DT VKFUH BTH NQUF FLGHLDWOU VR EGIFPG BIDJPVU. VKVU D LGB GCFUQU JU LEGQUKIZKQH VKSGDUU, DOF KPY WP OLUKJBVH BIDJPVU VKFO. PBPB PTJBPLTCWJQQT CUF PRX THIGDSULOI SMCQT QQ IQZ UJHZ ERQG ZJVK UJHTG WITHBVV, BPG ICYF EROVLOIHOEB QNDOU. XOHRSVXOCWFNB NCQZ QWIGU PTJBPLTCWJQQT JDWG QP ROBPV GQU HKYFP WITHBVV, BPG UJHTG DSG WIG ROGV XJLDJ DSG LO ORTV GBPJFT RG C GBODHKQH CWUCFL. CV JP PJNLUCUZ UBTVHNU, DO COMKHE HRSEH XQXMF VFVXQ USJGV XJRTG WBUN JV LT VR EGWFEW JPWSWVJQQT, CQE CQZ ERWGUU CFUKYJVLFU. IJIXSG 2.3 LMNXTVUBVHT VKJU FPPFFRW, XJHSG LOVUVULPP GFVHDVLPP DHGQUU DSG XTGG UQ OJUWFP WP PHUYRSM WSCIGKF, BPG OGWXQUL/WVFT DDVLWKWZ VR UTB BPG EGWFEW BPB CTHBEKFU LO UHDWUJVB.
If we analyse the cipher we can see that DWUJ is repeated three times and THBEK repeat twice. So we determine the repeated sequences:
DWUJ THBEK HBVV ODHC GWFEW UWFO NBNCQ TGWI FULO DJP EHT GIF PLT WJQQ JQQT OVU WUC QQT WUJ BEK VZUW GUQ UJHT GUU UJHZ WFEWB UVU GWIG DCOM GIFPF UVK VLT UVF KBU IGU WGF HCW THBV DSG THBE SQWFE UHD TJB GBID SGLO BVVB GLO EKF VBP IEGI HDWUJ CTH REG GGU TCWJ GIFP OUH EGIF PWSWG PTJB TCQE KFULO ULOI XTG IDJP ULOU CTHB UJVB QUU JQQTC PVUV WUJVB SWGFT QUL JPWSW BNCQ QQTC XQUL GQU FULOU CTHBE KFU FTR OGWX KFB VUVK KFO VUVF VZUWF TCWJQ HSUR EKFU CFL NCQ OGW OGV BNO CFU AVZUW UDO JHTG EGW WGFT EGI WITH XQU WUCF QPY YFP OUHDW URG JBPL HRS LPP GFHH QJPW PYQ PLTC JPVUV BPLT WJQ GGUQ OVUV HDW IFP WFO VKFU WFE BEKFU WUCFL FUL VKFO FUK FUH JPVU PVUVK HBEK BPLTC QPYQ WOU ZUWF SSQW SSQ GBIDJ TJBP WFEW BTH QIEG JBP ZJV WXQUL OUHD PVU QTC UHDWU SSQWF KJP KJU HBTHN DJPVU OMA ITH IDJPV ZER UUD ZJVK VRE GVKF BPG CNH EGIFP BPL SWG GFHHO HBVVB SWV TGW BID UCF WUJV DHG CWU CWJ MQPYQ UCFL CWF VVBPG GFV GFT NRD GFH OGWXQ JPW JPV OEHT LTCWJ PDH WITHB HUJ FHHOE DCO BTHN MQP HSU WJQQT VXJ JDWG UJV VKFUH DHC UJL THN GDS UJH BNC FVT THB GLOV NCQZ QJP HBTH GBI RGC ITHBV TJBPL HBV JUF KFUL TCW KFUH TCQ UHDW WIT FOV GWXQU BIDJP GLOVU JVKJP LOVUV LOVU QJPWS QWF DVL GWF VUL GWI VUV BPB HNU COM GWX QEC ITHB ZUWFO THBVV WFOV MQPY SQWF COMA GQUU IEG JPWS QWFEW CWUC WSWGF HBEKF OEH UFP QWFE ZJVKJ FHH LOI LOV JHT WSW LOU JHZ PPJ JQQ DWUJV WXQ VKJ VKF HHOEH PWS LOUH JVKJ HHOE GVXJ PWI GSU VUG HBE XJH JVB HDWU HBT KQH QIE FEWB VVB CQJ BEKF CQE JVK CQZ JVL FHHO BVV EKFUL SQW VVBP DJPV BVH NRDC BVVBP CQJPW JBPLT HOE IEGIF JDW VREG LOUHD PTJ WVU WVF PDHG PBP EWB QIEGI HTG AVZ LTCW FPW UWF ULO FPFF ZUW HUJH HOEH CQJP WXQU IDJ SUR IFPF DCOMA CWJQ CGF ODH NBN GWFE TVK HOEHT FEW RDC GWXQ WIG PWSW FBP NBNC VKJP VBPG BIDJ EGWFE ULOUH CWUCF UWFOV SWGF JVLT WSWV EGWF UJHTG SGL IFPFF PLTCW WSWG AVZU GVK FPF PTJBP DWU GVX DWG ULC VZU LTC VKJU PFF CWJQQ HHO
Analysing repeated length we get a count of:
3 letter:656 2 letter:337 6 letter:319 4 letter:217 12 letter:212 9 letter:200 7 letter:126 11 letter:78 8 letter:75 5 letter:70 15 letter:68 16 letter:54 14 letter:45 13 letter:36 10 letter:31
The Kasiski method then predicts key sizes of: 3 2 6 4 12 9 7 11 8 5 15 16 14 13 10 [here]