I seem to be having some problems with Vigenere.py for problem set 6. I am attempting to use ord to change the ith character in the plaintext into ASCii, but it is not working. Everything else seems to be logical I think?
Thank you for your help.
import sys
if len(sys.argv) == 2:
key = str(sys.argv[1])
if str.isalpha(key) == True:
plaintext = str(input("Enter the plaintext you wish you encrypt: "))
print ("ciphertext = ", end='')
for i in plaintext:
plaintext = ord(str(plaintext[i]))
#preventing long plaintext words from not being encrypted
if i > len(ciphertext) or k > len(ciphertext):
k = 0
cipher = ord(str(ciphertext[k]))
k += 1
else:
ciphertext = ord(str(ciphertext[i]))
#
final = (plaintext + ciphertext)%26
print (chr(final), end='')
else:
print ("Enter only letters")
else:
print ("Usage: Enter a key to use to ciphers")