code for generating tex output for kasiski

This commit is contained in:
Simon Pirkelmann 2020-01-28 18:43:44 +01:00
parent a93eb46871
commit 3b1b03c338

14
code/kasiski.py Normal file
View File

@ -0,0 +1,14 @@
ciphertext = "PPKAMJELQHPIAHLWYPKDDNBGPMJELQHPIAHZWUYJH"
blocks = ["", "", ""]
output = ""
for i in range(len(ciphertext)):
if i % 3 == 0:
output += "\\textcolor{red}{" + ciphertext[i] + "}"
elif i % 3 == 1:
output += "\\textcolor{blue}{" + ciphertext[i] + "}"
elif i % 3 == 2:
output += "\\textcolor{darkgreen}{" + ciphertext[i] + "}"
blocks[i%3] += ciphertext[i]
print(output)
print(blocks)