Exploitation of vigenere encryption with known key length
There is an english_freq variable, which means that the decrypted text must be in English. If you want to decipher a text in another language, you just have to change the letter frequency table
To launch the program you must execute the following command:
python3 exploit.py <key_length> <filename>
The decrypted text and the estimated key will appear in standard output
I provided an example file with key length 5
python3 exploit.py 5 vigenere_01_ciphertext.txt
Estimated Key: house
Decrypted text: atleastthewhispergoessoourlastkingwhoseimageevenbutnowappeardtouswasasyouknowbyfortinbrasofnorwaytheretoprickdonbyamostemulatepridedaredtothecombatinwhichourvalianthamletforsothissideofourknownworldesteemdhimdidslaythisfortinbraswhobyasealdcompactwellratifiedbylawandheraldrydidforfeitwithhislifeallthosehislandswhichhestoodseizedoftotheconqueroragainstthewhichamoietycompetentwasgagedbyourkingwhichhadreturndtotheinheritanceoffortinbrashadhebeenvanquisherasbythesamecovenantandcarriageofthearticledesigndhisfelltohamletnowsiryoungfortinbrasofunimprovedmettlehotandfullhathintheskirtsofnorwayhereandtheresharkdupalistoflawlessresolutesforfoodanddiettosomeenterprisethathathastomachintwhichisnootherasitdothwellappearuntoourstatebuttorecoverofusbystronghandandtermscompulsatorythoseforesaidlandssobyhisfatherlostandthisitakeitisthemainmotiveofourpreparationsthesourceofthisourwatchandthechiefheadofthisposthasteandromageintheland
The smaller the text, the more complicated the key estimation is, this is due to letter frequencies being distorted in small sentences.