DEV Community

Cover image for Cryptography Concepts Simplified
Dan
Dan

Posted on

Cryptography Concepts Simplified

What is Cryptography

Cryptography is scary, Its based on math that most of us don't understand yet it makes the internet secure.

Hard math equations

Cryptography takes bytes of data and scrambles them up with an algorithm making it really impossible for you to understand.

Brief History of Cryptography

Cryptography is the science of creating secrets and it has been around since 1900BC long before the computer.

Before humans got good at math, they used to tattoo messages on the scalps of slaves and wait for the hair to grow back, and send them to other leaders. Although this seems a bit vulnerable since the attacker can shave the head of the slave but it seems that the message itself seemed to work.

Old Cryptography using slave's head

Things got much better by the time of Julian Caesar who shifted the letters of the alphabet before passing the message to his military generals.

Ceaser Cipher

Important Cryptography Concepts:

Hash

The first concept we will look at is the hash, Hash is the action of chopping and mixing.

You start with an input that is any length that is passed off to a hashing function, this function will return a fixed length value of what looks like garbage.

Same Input -> Same Output

Hashing password

Salt

Now the fact that the hashing function will always return the same output, its a bit predictable and also a problem when it comes to passwords.

This brings us to the second cryptography topic which is Salt. Salt is a random value that is added to the password before it's hashed, therefore making it much harder to guess.

HMAC

Hash-Based Message Authentication Code is a hash that also requires a password, so the only person that can create the same hash signature must also have the corresponding hash password

Encryption

What if you want to share a secret with someone and allow them to read the original message. This is where encryption comes in.

With encryption we take a message scramble up the bytes and make it unreadable, this is called cipher text and provide a key allowing someone else to decrypt it.

Top comments (0)