Decrypting a Message
FUNCTION – def decrypt(cipher):
The connections on the wheels are bi-
Pertinent bits of code
#Decrypt each letter in the ciphertext string.
for e_char in cipher[1:]:
#Decrypt this character.
o_char = transformChar(e_char, selectedWheel, pointer)
#Do something if the character was decrypted ok.
if len(o_char) > 0:
plaintext += o_char #Add the character to the result.
pointer = (pointer + increment)%26 #Turn the wheel, using mod 26 to stay within circle.
Yes, you will find that a lot of grammatical information is lost in the encryption/decryption process, specifically all spacing and punctuation.
It is up to the message recipient to put that back, replacing “X” characters that do not make sense with full stops and inferring spaces where they are appropriate.