Codes and Ciphers

Hemanth Chitti
The Fun Of Cryptography
5 min readMar 23, 2020

We will continue from the previous post ( https://bit.ly/39cfxV0) into finding out the different ways of encrypting a message.

This time, rather than Alice and Bob let’s look at a real-life example.

Navajo tribes
Navajo tribals

Say hello to the Navajo tribes.

What’s interesting about them is that they have no written language. No alphabet, no symbols, nothing. Moreover what’s more interesting is that their language has a quite complicated syntax, and is very different from most foreign languages, making it nigh-impossible for a non-native speaker of the language to learn it. But why are we talking about the Navajo language?

The USA has used Navajo code-talkers in their wars, notably in the World Wars. The idea is that the Navajos will be able to understand their language and translate it into English, while an enemy will not even be able to make sense of what is being spoken. As I’ve already mentioned, it is very difficult for a non-Navajo to learn the language, so the enemies of the USA really struggled to figure out what was going on. But the US went one step ahead and made sure even Navajos wouldn’t understand what was going on without training — remember, the Navajo language is a tribal and ancient language which doesn’t have conceptions of foreign countries or modern technology. So submarines were referred to as “iron fish”; Britain, “between waters”; Germany, “iron hat”; Grenade, “potato”, etc. An untrained Navajo wouldn’t understand why warriors would be worried about potatoes!

There were more obstacles to breaking the code like there not being too many Navajo speakers in the world. I think I can leave it to your imagination now to understand why this system is secure. And it indeed, it was unbroken until the US themselves declassified these files in 1968.

The above is an example of a code, where you transform words or phrases based on their meaning. As we’ve seen in the example of the Navajos, we are translating entire words like Britain into the Navajo language. The key for a code, as in what transforms the plaintext* to the ciphertext** , is a dictionary. For the Navajo language it is the speaker, but for translating, say, French to English, all you need is a dictionary, in cryptological terms known as a codebook. And that is the key.

Let’s look at another example.

Since you’re all good readers, I’m sure you’d want to promote this blog. But your dad doesn’t like the posts of this upstart who keeps ranting about some Alice and Bob, so he forbids you from doing so. Of course you wouldn’t give up, so you’d try to encrypt it and send it to your friends without your dad getting to know. Again, since you’re all lovely readers, I’m sure you remember my earlier posts and encrypt based on the assumption that your dad is going to read your encrypted message.

Chinese book
Chinese book

Following the above example, you could write this in Chinese (because I don’t know Navajo and neither does Google Translate) and write it as 密码学的乐趣( Mìmǎ xué de lèqù).

There is another way to encrypt something , which I’ve already hinted upon in my post on Kerchkoff’s principle -transform the letters. So you could also say that the name of this blog is hTe uFn fO rCpyotrgpayh. I’ve followed a simple algorithm : if the word is even with length 2n then split it into n consecutive pairs and swap the letters of each pair. If it is odd with length 2n+1 then neglect the last letter and repeat the same as done for even with the 2n letters you have. So ‘The’ becomes ‘hTe’ and so on.

Notice that this algorithm doesn’t depend on the meaning of the word. It can be applied to any word and only depends on its length. And this is an example of a cipher, where you transform individual letters( or in general, symbols) of the plaintext to the ciphertext. Now, sometimes you see codes included under ciphers, but let’s treat them as distinct entities. The key here could just be 2 -if I define the algorithm as inverting groups of letters then the key and assume that the attacker knows this algorithm, then what should be hidden is the size of the groups, which in this case is 2. Never mind the fact that it’s laughably easy to figure out the key here.

Well, codes and ciphers are 2 really useful ways of encrypting a message. But while we do use codes, we usually study ciphers. The reason we do that is because generating a strong ciphers is more useful than generating a strong code. Why would that be so?

A simple reason that I’ll provide is that there is a larger overhead of key for a code, because you have to store an entire codebook. For a code, both the sender and receiver require a Chinese to English dictionary to encrypt and decrypt it(forget about Google Translate for now), and they have to look up every word.But for a cipher, you could easily swap the letters by yourself repetitively to decrypt the blog name and thus we can see that a cipher requires a smaller key to operate. The reason for this is because it doesn’t depend on the meaning of the text. It’s good to have smaller keys because we use encryption literally everywhere ; in ATMs, the Internet, email, WhatsApp, etc. Thus we prefer as small a key as possible because otherwise every single step of a process would be slowed down and then the overall speed of the system would reduce vastly.

That’s why we work on making stronger ciphers, because a strong cipher would be better to work with than an equally strong code. And that’s why in further sections we will restrict ourselves to studying ciphers alone.

*Plaintext-information that can be directly read by humans or a machine (like this article)

** Ciphertext- encrypted plaintext

(Definitions from https://www.open.edu)

--

--