**Cryptography**

Cryptography is the practice and study of using mathematical algorithm to encrypt and decrypt data. Cryptography enables you to store secret/sensitive information or transmit it across insecure networks (like the Internet) so that it cannot be read by third parties (called adversaries).

**Plaintext**

Data that we can read and understand without any special measures is known as plaintext or cleartext.

**Ciphertext**

The process of changing plaintext in such a way as to hide its substance is called Encryption. Encrypting plaintext results in unreadable gibberish called ciphertext.

**Cryptanalysis**

Cryptanalysis is the practice and study of analyzing and breaking secure communication. Classical cryptanalysis involves an interesting combination of analytical reasoning, application of mathematical tools, pattern finding, patience, determination, and luck.

**Types of Ciphers**

Modern encryption methods can be divided by two criteria:

- By type of key used
- By type of input data

By type of key used ciphers are divided into:

- Symmetric key algorithms (Private-key cryptography)
- Asymmetric key algorithms (Public-key cryptography)

By the type of input data ciphers are divided into:

- Block ciphers
- Stream ciphers

**Symmetric-key algorithms or Conventional cryptography**

Conventional cryptography is also called secret-key or symmetric-key encryption. Symmetric-key algorithms are a class of algorithms for cryptography that use the same cryptographic keys for both encryption of plaintext and decryption of ciphertext.

The following are examples of symmetric algorithm:

- Data Encryption Standard (DES)
- Triple- DES
- Blowfish
- IDEA (International Data Encryption Algorithm)
- RC4 , RC5 and RC6
- AES (Advanced Encryption Standard)

The following are strength and weakness of symmetric-key algorithms / systems:

**Strength**

- If we use large key size they are hard to break
- They are faster as compared to asymmetric key algorithms

**Weakness**

- Key management is a challenge
- This system provides confidentiality only
- Requires an out of band / secure mechanism to deliver key

**Asymmetric key algorithms**

Asymmetric key algorithm is also known as public-key cryptography. They refer to a class of cryptographic system requiring two separate keys, one of which is secret and one of which is public. Public key cryptography is an asymmetric scheme that uses a pair of keys for encryption: a public key, which encrypts data, and a corresponding private, or secret key for decryption.

The following are examples of asymmetric algorithm:

- DSA (Digital Signature Algorithm)
- El Gamal
- Diffie Hellman
- ECC (Elliptic Curve Cryptosystem)
- RSA

The following are strength and weakness of asymmetric-key algorithms / systems:

**Strength**

- It provides authentication and non-repudiation
- Better key distribution as compared to symmetric systems
- Better scalability

**Weakness**

- It works slower than symmetric key algorithm

**Block Cipher**

A block cipher is a deterministic algorithm operating on fixed-length groups of bits, called blocks, with an unvarying transformation that is specified by a symmetric key. Block ciphers are important elementary components in the design of many cryptographic protocols, and are widely used to implement encryption of bulk data.

A strong cipher contains the right level of two main attributes i.e. confusion and diffusion. Confusion is commonly carried out through substitution and diffusion uses transposition.

**Stream Cipher**

A stream cipher is a symmetric key cipher where plaintext digits are combined with a pseudorandom cipher digit stream (keystream). In a stream cipher each plaintext digit is encrypted one at a time with the corresponding digit of the keystream, to give a digit of the cyphertext stream.

With stream ciphers the bits generated by the keystream generator are XORed with the bits of the plaintext message.