(See Stroustrup, The C++ Programming Language (3rd ed.), p. 164).
How would you help decrypt messages encrypted using the OTP algorithm?
I'm able to encrypt messages alright using XOR:
The key ("pad") has the same number of characters as the message, and is generated using a truly random RNG; true randomness is required for perfect security.Code:while there are characters in message: message XOR key = ciphertext;
Suppose you're presented with an OTP-encoded message. How would you generate a list of plausable messages and keys?
My first idea was to generate message-key pairs by exhaustion and apply grammar rules for indo-european languages to each generated message, but that would have to be done ~10^21 times for a 20-character-long message.
Is there a quicker way to do this? I don't know where to start : (
Thanks.