October 5, 2019

# Cryptography

Today I am excited for writing an another interesting topic which is **cryptography**. I know it sounds like this topic is only for professionals who have a lot of experience & not for beginner but you what when I faced it I thought too but it is not so hard to understand.

Now you know that we are going to talk about cryptography but before that let me introduce myself. My name is Manshu Sharma, loves coding , marketing and data modelling, also loves to explore more other tech things and loves share my knowledge.

So start with a basic question

### What is Cryptography ?

According to books, Cryptography is the science and arts of transforming data to make them secure and immune to attack. Cryptography concern itself with the following objectives.

**Confidentiality**:- Protect the information from any authorised person.**Integrity**:- There should no modification.**Non****reputation**:- Sender/Receiver cannot deny of transmitted data.**Authentication**:- Ensure communication is authentic.**Data****availability**:- Data must be available to authorised parties.

Now we know what is cryptography but question arises **how it is work? **

### Working

In cryptography there are two major operations are performed which are

- Encryption :- Encryption is a process which transforms the original information into an unrecognizable form. This new form of the message is entirely different from the original message. That’s why a hacker is not able to read the data as senders use an encryption algorithm. Encryption is usually done using key algorithms.

- Decryption :- Decryption is a process of converting encoded/encrypted data in a form that is readable and understood by a human or a computer. This method is performed by un-encrypting the text manually or by using keys used to encrypt the original data.

#### New terms

**Cipher****text**:- Cipher-text is encrypted text. Plaintext is what you have before encryption, and cipher-text is the encrypted result.

**Cryptanalysis**:- A technique used for decrypting a message without any knowledge of the encryption detail. “Mainly hacker does this kind of analysis”

**Flow Diagram**

### Keys

In standard cryptography there are two standard cryptography’s keys which are used for performing encryption and decryption.

**Symmetric****Key**- Also known as secret key
- Sender and receiver uses same key for encryption and decryption i.e the key is shared in both parties.

**Note** Symmetric cipher is less secure and ease to break than Asymmetric cipher.

**Asymmetric****Key**:-- Also known as public key cryptography
- Sender and receiver uses different key for encryption and decryption namely public key and private key respectively.

### Standard key Algorithms

Below are different-different types of standard cryptography technique use for encryption and decryption.

**Symmetric****Algorithm**:- Symmetric encryption is a type of encryption where only one key (a secret key) is used to both encrypt and decrypt electronic information. The entities communicating via symmetric encryption must exchange the key so that it can be used in the decryption process.**Asymmetric****Algorithm :-**Asymmetric cryptography, also known as public key cryptography, uses public and private keys to encrypt and decrypt data. The keys are simply large numbers that have been paired together but are not identical (asymmetric). One key in the pair can be shared with everyone; it is called the public key. The other key in the pair is kept secret; it is called the private key. Either of the keys can be used to encrypt a message; the opposite key from the one used to encrypt the message is used for decryption.

### Hash Function

There is another important type of cryptography technique which is called** hash function.**

Before start about hash function first understand what is hash in cryptography. A hash is a method of cryptography that converts any form of data into a unique string of text. Any data can be hash no matter its sized, character used and type. **Note** :- A unique piece of data will always produce the same hash.

A cryptographic hash function is an algorithm that can be run on data such as an individual file or a password to produce a value called a checksum. In other words a type of security mechanism that produces a hash value, message digest or checksum value for a specific data object.

**Difference between hash and encryption **

Hash | Encyption |

Process using hash functions on data to map it to a fixed size numerical output | Process of encoding message or information in such a way that it can be access by authorised parties. |

Converts the data to hash or message digest which generated from plain text. | Use an encryption algorithm and key to convert the message to transmit into an unrecognisable format |

Does not use any keys | Uses keys |

Objective is to use of verifying data | Purpose of data to transmit data securely |

Output cannot be reversed back to original data | Encrypted message can be transformed into original message by using decryption algorithm with appropriate key |

Used for sending passwords, files and for searching | Used to transmit sensitive business information. |

The main use of a cryptographic hash function is to verify the authenticity of a piece of data. Two files can be assumed to be identical only if the checksums generated from each file, using the same cryptographic hash function, are identical.

### Further Symmetric Classification

Symmetric can be further classified in two different categories which are stream cipher and block cipher [based on methodology]

**Stream** **Cipher** :- A stream cipher is a method of encrypting text (to produce cipher text) in which a cryptographic key and algorithm are applied to each binary digit in a data stream, one bit at a time. In other words, In a stream cipher the plaintext is encrypted one bit at a time. This method is not much used in modern cryptography. The main alternative method is the block cipher in which a key and algorithm are applied to blocks of data rather than individual bits in a stream.

You can know more about stream cipher in the given link:- https://en.wikipedia.org/wiki/Stream_cipher

**Block** **Cipher** :- In a block cipher, the plaintext is broken into blocks of a set length and the bits in each block are encrypted together. A few of the most popular block ciphers are DES/3DES, AES, Blowfish, and Two fish.

You can know more about stream cipher in the given link:- https://en.wikipedia.org/wiki/Block_cipher

*Source :- **https://www.garykessler.net/library/crypto.html#fig02*