1
$\begingroup$

Having just finished reading The Code Book by Simon Singh, which I found extremely illuminating, nevertheless I remain deeply puzzled about one aspect in the book regarding the one-time pad cipher. To cut to the chase, I don't understand how a would-be hacker would be able to break a given OTP cipher (thereby deriving its plaintext) even if he or she already knew the key as well as its cybertext. Unlike the key of a Vigenere cipher, for instance, a key for a given OTP cipher is entirely random, therefore resistant to frequency analysis. The only workaround I can think of is that the OTP is itself a kind of Vigenere cipher? This, however, only takes me so far, sorry to relate. So to summarise: how can a hacker obtain an OTP's plaintext from its key? Many thanks!

$\endgroup$
2
  • 5
    $\begingroup$ The valid recipient also has the ciphertext and the key - how does he decrypt the ciphertext to recover the plaintext? $\endgroup$
    – poncho
    Commented Nov 22, 2022 at 18:48
  • 3
    $\begingroup$ It's ciphertext - i.e. the output of a cipher, not cybertext :) $\endgroup$
    – Maarten Bodewes
    Commented Nov 22, 2022 at 21:12

1 Answer 1

3
$\begingroup$

I don't understand how a would-be hacker would be able to break a given OTP cipher (thereby deriving its plaintext) even if he or she already knew the key as well as its cybertext.

That’s like asking, “I don’t understand how to make a noise if all I have is a klaxon horn”. Um - blow the horn! 😄

With an OTP, the “key” is a stream of random data of the same length as the plaintext message you want to encrypt.

  • You encrypt by XOR-ing each byte of the plaintext (P), with the corresponding byte of the random stream key (K). The result of that process is the ciphertext (C)(not “cybertext”).

  • You decrypt by XOR-ing each byte of the ciphertext C, with the corresponding byte of the exact same random stream key K. The result of that process is the original plaintext P.

So if you have C and K, that is all you need to get P.

Does that answer your question?

$\endgroup$
2
  • $\begingroup$ Help! I'm a newbe to cryptography - i.e. I had to go to Wikipedia to find out what XOR meant, and I'm still not sure! So, no, I don't altogether get what you're saying (but thanks for the input). I guess having the principle demonstrated in real time by someone using a pen and paper would work for me. Still, even if the process remains a mystery, the take-home message is that the plaintext CAN be deciphered from its key by a third party, come what may. At least that's clear enough now. $\endgroup$ Commented Nov 23, 2022 at 11:46
  • $\begingroup$ @Whatshisname: what that answer (as well as the first comment of the question) tells you is that with the key (also know as |secret] [random] pad) and ciphertext, all a hacker has to do is follow the normal decryption procedure of the OTP. You should understand how the OTP works in it's normal encryption and decryption uses, before trying to understand how it can be broken (if one of it's security assumptions does not hold). $\endgroup$
    – fgrieu
    Commented Nov 23, 2022 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.