Overview of Symmetric Key Cryptography
Tags: cryptography, blockchain, cybersecurity, security
Published: 2022-10-29 05:44:14

Today we usually use the word crypto in our daily conversations as short for cryptocurrency. The popularity of crypto, at least in public opinion, has completely overshadowed the underlying principles that cryptocurrency works upon. Cryptocurrency and various other applications - NFTs and DAOs are based on a single and the most fantastic technology of today - Blockchain.
Well, Blockchain is a technology and similar to other technologies, there is not one, not two, but many techniques and principles used from the book of science and mathematics for perfecting this technology, which still is not perfect and scalable to the scale we need it to be. However, Blockchain uses "Public-Key Cryptography", specifically Elliptical Curve Cryptography (ECC), for the identification and authentication of senders and messages. This article will only provide an overview of Symmetric Key Cryptography. The upcoming articles of this series will cover the various public-key cryptography techniques and possibly the underlying mathematics behind them.


## The meaning of the word Cryptography
Today the words "cryptography", "cryptology", and "cryptanalysis" are commonly interchanged. However, they have slightly different meanings. "Crypt" means hidden, and "graphy" means writing in Greek. So, cryptography means hidden writing. Typically when a cypher is constructed, the idea is that there is a person or a group who will "legitimately" decipher the text. In order to legitimately decipher, it is understood that the person will have access to what's referred to as a "key". Simply put, a "key" is any means of quickly and efficiently determining the original text. A good cypher system is constructed so that deciphering the text without the correct "key" is almost impossible.
Cryptanalysis refers to the analysis of hidden texts - cypher texts without having access to a legitimate "key" to break the cypher. Cryptology means the study of hidden writings or secrets. This encompasses both the establishment of encryption methods and analysis of a cypher in order to break it without the associated key.


## Symmetric Key Cryptography
The hiding of secrets in written and pictorial form to communicate information crucial to war strategies or even for simple games dates back thousands of years, going far back in time to ancient Egypt. These people used the type of cryptographic systems that incorporated "Symmetric Key Cryptography".
Symmetric key systems are cryptographic systems in which decrypting is as simple as reversing the encryption used. The sender encrypts the plain text with a key, and this encrypted text - cypher text is communicated over an insecure channel, and the receiver decrypts the cypher text using the exact same key. A trivial example of this kind is "Caesar Cypher", which comes under the family of "substitution cyphers". The letters in the plain text are replaced by some other letters of the same alphabet in a fixed pattern that both the sender(obviously) and receiver are aware of.

The simplicity of using the same key both to encrypt and decrypt is offset by the difficulty of ensuring that all parties involved have the needed keys in a tense situation and also when people may be widely dispersed geographically. The lack of an ideally secure channel in such environments for exchanging keys is the deal-breaker for symmetric key cryptography. People have tried their way around it by using "code books" in the 1800s, which listed which keys to be used on which dates of the month. The sender and the receiver both needed a copy of the same "code book" for this. However, if the "code book" gets compromised, the communication over the entire duration would be leaked, which would most likely lead to devastating consequences.

## Confusion and Diffusion
Claude Shannon was one of the first to formalize the principal aims of a cryptographic system. He argued that a cryptosystem designer should assume that the system may be attacked by anyone who has access to it., as was indeed the case during the two world wars when machines were stolen and reverse engineered. He argued that the only point of secrecy should be the key, but that the system design should complement the security by incorporating the "confusion" and "diffusion". Confusion is intended to make the relationship between the key and the cypher text as complex as possible. Diffusion refers to rearranging or spreading out the bits in the message so that any redundancy in the plaintext is spread out over the cipher text so that the complexity for recognizing patterns in cypher text is increased multifold.


## The Enigma
Enigma Encryption Machine - Mechanical Cypher MachineEnigma machine designed by Arthur Scherbius and used by Germans during WWII utilized a symmetric key encryption technique. In this case, the "key" was the setup configuration of the machine, including the rotors utilized, the rotor order, the ring setting of each rotor, the starting position of each rotor, and the plugboard letter swaps on the front panel.
Both the sender and receiver needed to have the exact setup configuration of the machines to communicate. At the start of every month, a list of that month's day keys were distributed. This is an example of the "code books" technique in symmetric key cryptography.


![enignma.jpeg](https://cdn.hashnode.com/res/hashnode/image/upload/v1663498085900/fvhEXodR4.jpeg align="left")

For extra security, after an Enigma operator set up his machine with the day key. He would then choose to rotate the position of each rotor to some random position called the Grundstellung or indicator-setting. This information was communicated to the receiver unencrypted. The sender would then select a new series of random letters to encrypt and type them into the Enigma twice consecutively. After entering this information, the sender would rotate the rotors once again to the position of the random letters previously chosen and entered. The sender now proceeds to encrypt the message.

The receiver would have the Enigma set with the day key settings. He would then receive the Grundstellung unencrypted from the sender and change the Enigma configuration accordingly. Next, the initial two consecutive series of encrypted random letters would be entered, revealing the rotor position settings to be set to decrypt the remaining message.

Hope you learnt something new and interesting. If you find cryptography and Blockchain exciting, follow me because I will be coming up with more on this.

Adios 😊!