# Cryptography before Jesus Christ(LEVEL 2)

Now let’s talk about digital cryptography, a bit of background is important. Julius Caesar used to substitute alphabets in his secret letters, for example he would substitute “D” by “T” thus DOG became TOG. Inspired by this we have ROT13 where every alphabet is moved by 13 places for example DOG is QBT, these are called substitution ciphers. There is a problem, the problem is everyone who knows the substitution can decrypt it and get the data.

# MODERN CRYPTOGRAPHY:

So things get bit interesting here, after computers came into existence so came people to poke around, that is hackers and a problem to keep data safe was already a issue but bigger was how to send it safely.

# Asymmetric Encryption:

Now we had issues with symmetric encryption, the issue was there was a single key that would lock and unlock the lock thus if that key fell into wrong hands then your information is compromised. Asymmetric Encryption solves that very issue. Here instead of one key, we use two keys but its different from key stretching by that the keys are derived but not directly related to each other. Let me explain:

# DIGITAL SIGNATURES:

Remember the rule? Well, rules are meant to be broken, what if we use our private key to encrypt the data? Then since everyone who has our public key can decrypt the data. Then what's the purpose one may ask? Well if someone can use your public key to decrypt your data then it means the data has was never tampered with, what do I mean? since no one has access to your private keys then the data must be yours since everyone is able to decrypt it using your public key which is derived from your private keys. This is called Nonrepudiation.

# Cipher Modes:(Level 3)

There are different cipher modes; most symmetric keys use a block cipher and can encrypt a large amount of data quicker than asymmetric encryption. Let’s look at these in turn:

# XOR Encryption(Internal Working){LEVEL 4}:

Before i start, congrats you’ve made it so far, i would like to thank Mukul Sir who around a year back, taught few of the lucky ones what XOR gates and how they work. I have since many books on XOR and took me some time to understand it.

# XOR and TRUTH TABLES:

“XOR” an abbreviation for “Exclusively-OR.” The simplest XOR gate is a two-input digital circuit that outputs a logical “1” if the two input values differ, i.e., its output is a logical “1” if either of its inputs are 1, but not at the same time (exclusively). The symbol and truth table for an XOR is shown below. The Boolean expression for a two-input XOR gate, with inputs A and B and output X:

# Turning Symmetric Encryption Secure(Level 5):

If you have come so far, congratulations. Now as you know by now that symmetric Encryption is not secure due to the risk of the key being stolen well, there exists a hybrid solution. What if we can securely send the key through asymmetric encryption and use fast symmetric encryption to send the messages?

--

--

## More from Ravaan

CEH(Practical),Red Teamer/BBHH. Have hacked Governments to fortune 500 companies/UN. Hunt of CVEs occasionally with my team.CVE-2022-30076. Bookworm

Love podcasts or audiobooks? Learn on the go with our new app.

## Ravaan

1.1K Followers

CEH(Practical),Red Teamer/BBHH. Have hacked Governments to fortune 500 companies/UN. Hunt of CVEs occasionally with my team.CVE-2022-30076. Bookworm