- Symmetry
- Asymmetry
- Hash function

### Symmetry Cryptograph

E.g One time pad/ Caeser Cipher /Enigma Machine they have same key to encrypt and decrypt

### Asymmetry Cryptograph

E.g One time pad/ Caeser Cipher /Enigma Machine they have same key to encrypt and decrypt

*Encryption and decryption should follow this mechanism*

- Confusion- Message and Key
- Diffusion- Message and Cipher Text

Data Encryption Standard: DES vs AES: Advanced Encryption Standard

**AES 256**

Provides confusion

**Cipher Block Chaining**

Provide Diffusion

## Classes Of Cryptographic Hash Functions

There are several different classes of hash functions. Here are some of the most commonly used:

- Secure Hashing Algorithm (SHA-2 and SHA-3)
- RACE Integrity Primitives Evaluation Message Digest (RIPEMD)
- Message Digest Algorithm 5 (MD5)
- BLAKE2

## An Intro To One-Way Hash Functions

Hash functions are often called one-way functions because, according to the properties listed above, they must not be reversible. If an attacker could easily reverse a hash function, it would be totally useless. Therefore, cryptography requires one-way hash functions.

The best way to demonstrate a one-way function is with a simple modular function, also called modular arithmetic or clock arithmetic. Modular functions are mathematical functions that, put simply, produce the remainder of a division problem.

So, for example,

*10 mod 3 = 1*. This is true because 10 divided by 3 is 3 with a remainder of 1. We ignore the number of times 3 goes into 10 (which is 3 in this case) and the only output is the remainder: 1.
Let’s use the equation

*X mod 5 = Y*as our function. Here’s a table to help get the point across:
You can probably spot the pattern. There are only five possible outputs for this function. They rotate in this order to infinity.

This is significant because both the hash function and the output can be made public but no one will ever be able to learn your input. As long as you keep the number you chose to use as X a secret, it’s impossible for an attacker to figure it out.

Let’s say that your input is 27. This gives an output of 2. Now, imagine that you announce to the world that you’re using the hash function X mod 5 = Y and that your personal output is 2. Would anyone be able to guess your input?

Obviously not. There are literally an infinite number of possible inputs that you could have used to get a result of 2. For instance, your number could be 7, 52, 3492, or 23390787. Or, it could be any of the other infinite number of possible inputs.

The important point to understand here is that one-way hash functions are just that: one-way. They cannot be reversed.

When these same principles are applied to a much more sophisticated hash function, and much, much bigger numbers, it becomes impossible to determine the inputs. This is what makes a cryptographic hash function so secure and useful.

Regardless of the length of the input, the output will always be the same fixed length and it will always appear completely random. Play around with this tool to see for yourself.

This online tool allows you to generate the SHA256 hash of any string. SHA256 is designed by NSA, it's more reliable than SHA1.

Enter your text below:

Generate

Clear All

MD5

SHA1

SHA512

Password Generator

SHA256 Hash of your string: