From 3b1b03c33843e8188b25f14f0597f9222948a516 Mon Sep 17 00:00:00 2001 From: spirkelmann Date: Tue, 28 Jan 2020 18:43:44 +0100 Subject: [PATCH] code for generating tex output for kasiski --- code/kasiski.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 code/kasiski.py diff --git a/code/kasiski.py b/code/kasiski.py new file mode 100644 index 0000000..7eca817 --- /dev/null +++ b/code/kasiski.py @@ -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)