## There are quite a few ways to sort out the types of algorithms in cryptography. Generally, they are categorized based on the number of keys that are used for encryption and decryption, and they also defined how we apply or use them. The three main types of algorithms are:

**Secret Key Cryptography (SKC):** Employs a single key for both encryption and decryption; also called symmetric encryption. This algorithm is mostly used for privacy and confidentiality.

**Public Key Cryptography (PKC):** Uses one key for encryption and another key for decryption; it is also known as asymmetric encryption. It is mainly used for authentication, non-repudiation, and key exchange.

**Hash Functions:** Uses a mathematical transformation to “encrypt” information in an irreversible manner, producing a digital fingerprint. This method is primarily used in message integrity.

**Secret Key Cryptography**

Methods of secret key cryptography only use a single key to do both encrypting and decrypting. The receiver uses the same key to decrypt the message and get the plaintext. Because a single key is used both ways, secret key cryptography is also known as symmetric encryption.

With this type of cryptography, obviously both the sender and the receiver have to know what the key is actually the secret. The biggest difficulty doing things this way is, of course, how the key is distributed (we’ll discuss more on that in the public key cryptography).

Secret key cryptography schemes are generally considered to be either stream ciphers or block ciphers.

**Public Key Cryptography**

It is said that public key cryptography has been the most significant new development in the history of cryptography within the past 300-400 years. The first public illustration of Modern PKC was by Professor Martin Hellman and graduate Whitefield Diffie of Stanford University in 1976. Their study described a two-key crypto system where two parties could be involved in a secure communication via a non-secure channel and not having to share a secret key.

PKC relies on the something called one-way functions. These are mathematical functions that can be computed with ease while their inverse function is, on the other hand, difficult to calculate.

The mathematical “trick” in PKC is to find something called a “trap door” in the one-way function in order for inverse calculation to become easy provided that there is knowledge of some items of information.

**Hash Functions**

Hash functions, or some call them one-way encryption and message digests, are algorithms that essentially use no key at all. Instead, a hash value with consistent length is calculated based on the plaintext. In this manner, it is impossible to recover either the contents or length of the. Hash algorithms are generally used to produce a digital fingerprint of a file’s contents, often used to make sure that the file has not been tampered with by any intruder or virus. Hash functions are also commonly used by many operating systems to encrypt passwords. Therefore, hash functions provide integral security for a file.

Hashes are irreversible encryption. You cannot take a hash and “decrypt” it to figure out the original string that formed it, in spite of the fact that many web sites suggest or claim otherwise such as MD5 Online, OnlineHashCrack, and RainbowCrack.

This is an important unique attribute of hash functions. If you want to crack someone’s password, and the hash of the password is stored on the server. In theory, you will only require a string that produces the correct hash and you are good to go! However, you won’t have any evidence that you have found the actual user’s password, it may only be a “duplicate key.”