One-Time Pad Examples
Learn about the effects of reusing keys in one-time pads and explore the one-time pad using a Latin square example.
We'll cover the following
Consequences of key reuse in a one-time pad
An important property of a one-time pad is that keys should be used only once. We now demonstrate why this is the case. To keep things really simple, we’ll use the Caesar cipher one-time pad to encrypt single-letter plaintexts.
Suppose two plaintext letters, and , have been encrypted using the same one-time pad key (in other words, key has been used twice) to produce two ciphertext letters, and . This means an attacker knows that both and have arisen by shifting and the same number of positions. Thus, the attacker learns that the number of letters between and is the same as the number of letters between and . This doesn’t immediately tell the attacker what either or is, but it’s certainly information the attacker did not have before.
We can make this statement more precise by using the mathematical description of the Caesar cipher, which is the following:
Since an attacker can see C1 and C2, the attacker can subtract C1 from C2 to get the following:
This can be seen in the code given below:
Get hands-on with 1200+ tech skills courses.