Vigenere Cipher 'string Index Out Of Range' For Decryption
my Vigenere cipher works perfectly for encryption but I just need to fix this problem for decryption where I am told, after running the program, that the string index is out of ran
Solution 1:
If your key text is longer than key phrase you'll get an invalid index here :
new = ord(_key_phrase[letters]) - ord(_key_text[letters%len(_key_text)])
when letters
becomes greater than len(_key_text)
You have key_text
on both places in encryption
and key text
and key phrase
in decryption so you have to change one variable here.
Post a Comment for "Vigenere Cipher 'string Index Out Of Range' For Decryption"