From fea7c17c105a97d2a3a29961abe8e1a88edbf305 Mon Sep 17 00:00:00 2001 From: "E. Almqvist" Date: Sun, 10 May 2020 01:35:40 +0200 Subject: [PATCH] Caesar chiffer bug fix --- caesar.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/caesar.py b/caesar.py index 24f10a2..f11805f 100755 --- a/caesar.py +++ b/caesar.py @@ -25,13 +25,14 @@ for char in txt_list: # loop through all of the chars charindex = charindex + 1 index = alphabet[in_alphabet].index(char) - print("Decrypting char-index: " + str(charindex) + " (" + char + ")") + print("Decrypting char-index: " + str(charindex) + " (" + char + ":" + str(index) + ")") index = index + in_key # shift the alphabet while( index > alen - 1 ): #cycle through the alphabet - print("Alphabet cycle") - index = index - (alen - 1) - - decryp_list[charindex] = alphabet[in_alphabet][index] + index = index - alen + print(" Alphabet cycle, index: " + str(index)) + + charDe = alphabet[in_alphabet][index] + decryp_list[charindex] = charDe print( "Output: " + listToString(decryp_list) )