I'm writing the code for the one time pad in python, and I've run into an issue.
I randomly choose a key from the ascii table (meaning it doesn't have to be a letter) And after I xor it with the plaintext message (which is only alphabet letters)-- I get a ciphertext that is nonsense. The xor is fine, I get that the answer should be that nonsensical ascii character, but my question is- can I get the code to return back an alphabet letter?
I was trying to work this out and my pseudo code so far was:
for i in msglen: c[i]=msg[i] ^ key[i] if c[i]<65: c=(c+65)%26 #add 65 to bring up to alphabet, mod 26 in case it goes over c+=65 #add another 65 to make up for the modular reduction. But obviously I got stuck in the decryption part.