code-break-party/code/kasiski.py

15 lines
434 B
Python
Raw Normal View History

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)