Your example is not actually a perfect one time pad, because rand(0,99)mod26 is not the same distribution as rand(0,25). There is a 4% chance of a shift between 0 and 21 and a 3% chance for a shift of 22 to 25. For comparison, consider if there was a 0.01% chance of a shift between 1 and 25, and a 99.75% chance of a shift of 0. You'd be pretty sure the message was unchanged. In this way, with a sufficiently large message size, your cipher could be broken with frequency analysis. The OTP is only as good as the random distribution! An additional rule would therefore be that the random distribution must be uniform.
@__Razer2 жыл бұрын
The problem with "Perfect Security" is the "Rules for Perfect Security". The security is only as good as your security of the key, and how do you perfectly securely store or transmit the key to the recipient of the message? I can think of a few reasonably secure ways to do it, but it's not _perfect_. You can have two identical books with hundreds of pages of keys, and include the page number of the key for the message in plain text with the message, with prior instruction to destroy a page after it is used. Of course, the book itself would still be vulnerable to compromise, if anyone were able to copy it or steal it, and intercept a message, your message is no longer secure.
@toby99992 жыл бұрын
It goes without saying that securing the key is important but that's not important to the theory.