# Secret-Key (Symmetric) algorithm

We use cryptography to protect information. Crypt means hidden and -graphy stands for writing. We use set of mathematical concepts and some rule-based calculations to secure information. This information can be at rest or at transit. Authentications, Integrity and confidentiality are components of Cryptography. This is not a new concept; it runs back to some centuries. Earliest cryptography method was used by the Spartans in ancient Greece. It is a rod used as an aid for a transposition cipher. The sender and receiver had identical rods (scytale) on which to wrap a transposed messaged. When we need to avoid someone else seeing the information while transmitting or when stored, we convert it into an unreadable message using some algorithms. Those who know how to decrypt (Key or decryption algorithm) can only read it.

To understand about the cryptography, let me take a popular example. Bob and Alice.

Think of an instance where Alice needs to send a secret message to Bob. Alice does not like Eve to read and understand it. Unfortunately Eve is the only person who can send this message to Bob. So how can Alice send it? There comes the cryptography. She can change the order of letters; Ex: alice -> ecila . Or else she can use symbols for letters. This process is known as encryption. Likewise, she can use one of the encrypting methods and tell Bob about the way to read it. Then Bob can decrypt the message because she knows what encryption method Alice used. This is called decryption. The message that is encrypted is known as a cipher.

Cryptology is the science of making and breaking secret codes. It combines cryptography (development and use of codes), and crypt analysis, (breaking of those codes).

Different algorithms are associated wit cryptography. Ancient time the secret was the algorithm. When someone get to know about the algorithm, they can decrypt the cipher. So, they tried their best to hide the encryption algorithm from unauthorized people. Further reverse engineering made it easy to find the decryption algorithm. In modern cryptography key has become the secret rather than the algorithm. Though some know the algorithm cipher cannot be decrypted without the key.

From this blog I will focus on the secret key algorithms.

**Secret Key Algorithms**

A *secret key algorithm* *, symmetric encryption algorithm* or shared secret key algorithm uses the same key to encrypt the message and decrypt the cipher. Both the parties share the key before hand. Symmetric encryption is fast because because the key size is small and uses small mathematical operations. It uses keys of 128–256 bit long size.

*Common secret key algorithms.*

- DES (Data Encryption Standard)
- 3DES (Tripe Data Encryption Standard)
- AES (Advanced Encryption Standard)

Now let’s look at some of these algorithms.

**Data Encryption Standard (DES)**

DES is a block cipher algorithm which converts 64 bit texts to a cipher text using a 56 bit long key. This is one of the most popular secret key algorithms. DES operations can be done in 2 ways.

**Electronic Code Book(ECB)**

In ECB method it serially encrypts 64- bit plain text blocks using 56 bits key. The main disadvantage of this method is it creates identical cipher texts for identical plain texts as it uses the same key for encryption. So it is vulnerable for crypt-analysis.

**Cipher block chaining (CBC)**

Shortcomings of ECB method were eliminated by CBC method. In this method an initial vector is XOR-ed with the 1st plain text and then encrypted with the DES key. It always XORs the previous cipher block with the current plain text before encrypting with the DES key. This method was much secure than ECB method.

But DES is vulnerable to modern brute force attacks because of it’s small key size. So world deviated to 3DES which is more secure than DES.

- Tripple Data Encryption Standard (3DES/TDES)

3DES uses 256 bit key which made 3DES more secure than DES. 3DES is 3 times DES. This encrypts each 64 bit block in plain text 3 times using the DES key. It uses 3 keys with 256 bits to encrypt the plain text, to decrypt the cipher with the 2nd key and encrypt that again with the 3rd key.

There are several ways of applying 3-DES

**2 EDE — 3DES **Use 2 keys to encrypt, decrypt, encrypt

**3 EDE — 3DES **Use 3 keys to encrypt, decrypt, encypt

**2 EEE — 3DES **Use 2 keys to encrypt, encrypt, encrypt

**3 EEE — 3DES **Use 3 keys to encrypt, encrypt, encrypt

Using 3DES is a much slower process.

- Advance Encryption Standard (AES)

This is most widely use symmetric encryption method. This is nearly 6 times faster than 3DES. AES is also a block cipher which uses keys with 128/192/256 bits. Mostly common used key size is 128 bits. This is much stronger than DES because of its key size.

From this blog I have discussed about some symmetric encryption algorithms. To know about public key algorithms, refer my blog about public key algorithms.