I'm supposed to create a program that uses a word as the encryption key that behaves like this in the end
Thanks in advanced!
$ python vigenere.py Type a message: The crow flies at midnight! Encryption key: boom Uvs osck rmwse bh auebwsih!My main issue is with the encrypting aspect of it.
def vigenere_cipher(plaintext, key): encrypted_string = '' for i in range(len(key)): # loop over plaintext by index plaintextVal = ord(plaintext) # if character in plaintext is alpha do the following: keyVal = ord(key[i]) keyVal = keyVal - 97 # get alphabet position for character in key plaintextChar += chr(keyVal + plaintextVal) if plaintextVal >= ord('z') #get alphabet position for character in plaintext plaintextVal = plaintextVal - 26 # rotate character from plaintext with a character from the key # convert new position back to a character if you haven't done it already # concatenate new character to an encrypted string print PlaintextVal return encrypted_stringI'm getting a bunch of invalid syntax error throughout and I'm confused on how to go about fixing the code.
Thanks in advanced!