I am new to cryptography and I am very confused. In fact, I am so confused that I have trouble providing a suitable title for my thread...

I know that a Substitution Cipher is designed to substitute one letter or character for another, to produce a ciphertext as shown in the picture belowenter image description here

enter image description here

With most symmetric cipher, the final step is to combine the cipher stream with the plaintext to create a ciphertext using XOR binary logic encryption.

My question is

  1. why is the plain text, cipher stream and cipher text all in binary? In the first picture, it is all in letters, now in the second picture, it is all in binary.
  2. Where does the single key from the symmetric cryptography take place?
  • $\begingroup$ I'm confused by your question #2. What do you mean? Do you mean how is it generated? Or how is it distributed? $\endgroup$
    – mikeazo
    Feb 16, 2018 at 16:22
  • $\begingroup$ @mikeazo "With most symmetric cipher, the final step is to combine the cipher stream with the plaintext to create a ciphertext" Then what is the key used for? I thought the key should encrypt the plaintext to a cipher text? Why is it not shown in the picture? $\endgroup$
    – XxS0ul678
    Feb 16, 2018 at 16:25

2 Answers 2


For #1, binary is used for a number of reasons. First, XOR is a logical operator, so it only operates on bits. Modern computers store everything as bits, too, so that makes XOR convenient.

As for why the first picture is not in bits, that is because no one uses (or at least should) use substitution ciphers such as the one proposed on modern computers. That substitution cipher is extremely insecure. Those sorts of ciphers were typically seen in the pre-computing age, so showing it with an alphabet instead of in bits makes sense. You could, however, show the same graphic with binary text. You'd first have to break up the binary into groups of values (maybe 4 or 5 bits per group) and show a substitution table for the 4 bit values.

For #2, the key is used to produce the cipher stream. That is not shown in the picture.

  • $\begingroup$ But why is the first picture not in bits? That's is what I am confused about $\endgroup$
    – XxS0ul678
    Feb 16, 2018 at 16:31
  • $\begingroup$ @XxS0ul678, updated my answer. $\endgroup$
    – mikeazo
    Feb 16, 2018 at 16:37
  • $\begingroup$ Hey so one last question, all of the pictures regarding cipher text shown in my network security fundamentals books, are in scrambled form such as "626vsccPO)". So they too can be converted into binary text? In real life scenario, are the ciphertext, plaintext shown in binary text or in scrambled text 626vsccPO)? $\endgroup$
    – XxS0ul678
    Feb 16, 2018 at 16:48
  • 1
    $\begingroup$ @XxS0ul678, I don't know about you, but I don't read binary very well. I prefer things formatted into nice PDF documents or Word document or even text documents. So when someone is sending me encrypted data, I expect that once I decrypt it, I can open it in whatever the normal program is. In real life, I don't look at ciphertext either. What is the point, it is meaningless. That said, what is stored on the computer, either way, is binary. $\endgroup$
    – mikeazo
    Feb 16, 2018 at 17:21

why is the plain text, cipher stream and cipher text all in binary? In the first picture, it is all in letters, now in the second picture, it is all in binary.

Because classical cryptography (e.g., substitution ciphers) usually was done on text represented as sequences of letters, whereas modern cryptography is usually done on data (not necessarily textual) represented as bits. Although there have been ternary computers, they are a historical curiosity for the most part; computers in practice work in binary, so modern cryptography does so as well.

This is however an incidental, not essential distinction. Mathematically you could formulate modern algorithms to work on letters instead of bits. One way to perceive this is to think of one-time pads, and in particular historical pen-and-paper instantiations thereof. It's relatively straightforward to write a program that, given a password and page number as input, uses a modern stream cipher to reproducibly generate a page with pseudorandom characters that looks very much like the one in the latter link, which you could then use with pen and paper to encrypt messages. That would be a stream cipher, but based on letters instead of bits.

Note that, mathematically, the same sort of thing is going on:

  1. Messages are encoded into sequences of symbols drawn out of some abstract finite, ordered "alphabet" (in the mathematical sense, not the everyday sense). In the alphabetical ciphers the alphabet is the familiar one with 26 letters, while in the binary ciphers it's the set $\{0, 1\}$.
  2. Messages are encrypted by shifting the symbol at each position by an amount that is randomly and independently chosen for each position.
  3. The sequence of shifts to be applied to each position in the message is called the keystream. In historical one-time pads this keystream and the shifts are encoded as letters, while in modern bit-based ciphers it's encoded as a sequence of bits.

The difference is that in one-time pads the key is the random keystream, while modern stream ciphers are algorithms for generating long pseudorandom keystreams from short random keys.


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.