# Cryptography -Types and Algorithms (MD5 Encrypt and Decrypt)

Cryptography is a tool for protecting information in our computer systems. The art of protecting information by encrypting into an unreadable format, called as cipher text. Only those who possess a secret key can decrypt the message into original text.

The Encrypted messages can sometimes be broken by cryptanalysis, also called code breaking. Cryptography systems can be broadly classified into symmetric-key and public key.

- In Symmetric Key Systems, it uses a single key that both the sender and recipient have.
- In public key Systems, it uses two keys, a public key known to everyone and a private key that only the recipient of messages uses.

**Purpose of Cryptography**

Cryptography not only protects data from theft, but can also be used for user authentication. There are, in general, 3 types of cryptographic schemes typically used to accomplish these goals: Secret key Cryptography, Public-key Cryptography, and Hash Functions. In all cases, the initial unencrypted data is referred to as plaintext. It is encrypted into ciphertext, which will usually be decrypted into usable plaintext.

**Suggested Read:** A to Z – Network Security Related Abbreviations and Terms

**Types of Cryptographic Algorithms**

There are several ways to classify cryptographic algorithm. So mainly there are 3 types of algorithms we used,

- Secret key Cryptography (SKC)
- Public Key Cryptography (PKC)
- Hash Functions

**1. Secret key Cryptography**

With this method, only a single key is used for both encryption and decryption mechanism. Here the sender uses the key to encrypt the plaintext and sends back the ciphertext to the receiver side.

The receiver applies the same key to decrypt the message and recover the plaintext. Because a single key is used for both functions, secret key cryptography is also called symmetric encryption.

**2. Public Key Cryptography**

It is the most significant new development in cryptography. Generic PKC employs two keys that are mutually related although knowledge of one key does not allow someone to easily determine the other key.

One key is used to encrypt the plaintext and the other key is used to decrypt the ciphertext so this approach is also called as asymmetric cryptography.

**3. Hash Functions**

It also called as message digests or one-way encryption, are algorithms that, in some sense, use no key.

Instead, a fixed-length hash value is computed based upon the plaintext that makes it impossible to be recovered. They are typically used to provide a digital fingerprint of a file’s contents.

They are also commonly employed by many operating systems to encrypt passwords. Hash functions, then, provide a measure of the integrity of a file.

**Cryptographic Algorithms**

There are of course a wide range of cryptographic algorithms in use which are as follows:-

**1. DES (Data Encryption Standard)**

It operates on 64-bit blocks of data, using a 56-bit key. It is a ‘private key’ system.

**2. RSA (Rivest, Shamir, and Adleman)**

RSA is a public-key system designed by Rivest, Shamir, and Adleman.

**3. HASH**

A ‘hash algorithm’ is used for computing a condensed representation of a fixed length message/file. This is sometimes known as a ‘message digest’, or a ‘fingerprint’.

**4. MD5 (Message Digest)**

MD5 is a 128 bit message digest function. It was developed by Ron Rivest.

**5. AES (Advanced Encryption Standard)**

This is the Advanced Encryption Standard using the Rijndael block cipher approved by NIST.

**6. SHA-1**

SHA-1 is a hashing algorithm similar in structure to MD5, but producing a digest of 160 bits (20 bytes). Because of the large digest size, it is less likely that two different messages will have the same SHA-1 message digest.

**7. HMAC**

HMAC is a hashing method that uses a key in conjunction with an algorithm such as MD5 or SHA-1. Thus one can refer to HMAC-MD5 and HMAC-SHA1.

**Introduction to MD5 Algorithm**

MD5 is widely used Hash Algorithms by Website owners. MD5 was designed by Ron Rivest in 1991 to replace an earlier hash function, MD4. It is not like usual encryption. Usually we encrypt the original text to cipher text then decrypt the cipher text to normal text.

**Also Read: **20 Tips and Tricks to Make Your WordPress Website More SEO-Friendly

We can call the MD5 as “**One Way Encryption**”

Using MD5 Hash algorithm we can only create a hash code. Original Text is converted to 128 bits hash code (encrypted form).

Consider my original text is “techhyme”.

It will be converted to

98a064d4de4f94a52c4828feeaa480e6

**MD5 HASHES:**

The 128-bit (16-byte) MD5 hashes (also termed message digests) are typically represented as a sequence of 32 hexadecimal digits.

The following demonstrates a 43-byte ASCII input and the corresponding MD5 hash:

MD5 (“The quick brown fox jumps over the lazy dog”) = 9e107d9d372bb6826bd81d3542a419d6

*The hash of the zero-length string is:*

MD5 (“”) = d41d8cd98f00b204e9800998ecf8427e

**How to Crack MD5?**

You don’t need to write algorithm to crack the MD5. There are plenty of websites available to crack the MD5.