Encryption
What's encryption and why do we need it?
What Is It?
Encryption is a cipher method
What's a cipher method you're asking?
Well a simple example is the Caesar cipher, this cipher takes your sentence and shifts it X alphabet characters left or right
Example
If he had anything confidential to say,
he wrote it in cipher,
that is,
by so changing the order of the letters of the alphabet,
that not a word could be made out.This is the dictionary that will be used:
abcdefghijklmnopqrstuvwxyzIt will be case insensitive, maintain our sentence casing (lower / upper case) and any other character that is not part of the alphabet will be included without any change
Tq sp slo lyjestyr nzyqtopyetlw ez dlj,
sp hczep te ty ntaspc,
esle td,
mj dz nslyrtyr esp zcopc zq esp wpeepcd zq esp lwaslmpe,
esle yze l hzco nzfwo mp xlop zfe.Try it yourself
Why Do We Need It?
We need encryption to ideally hide data from unwanted people that might gain access to it
I wrote ideally because as long as the encryption method is too weak or the encryption key is guessable / saved in proximity with the data itself; it'll be a lot easier to uncover the data
Encryption Types
There are 2 encryption types available:
Symmetric Encryption
In symmetric encryption both parties use the same passphrase / password / value to both encrypt and decrypt the data
Advantages
- A lot faster than asymmetric encryption since they use the same key for both operations (100x to 1000x faster)
- Uses less CPU and RAM for the encryption process
- Smaller data size compared to asymmetric encryption
This makes symmetric encryption good for realtime high volume of data (throughput) and smaller sized storage devices
Disadvantages
- Need to make sure that you're sending the shared encryption key securely to the recipient
Note
This is a super high concern and the whole reason why asymmetric encryption is more secure by design
Asymmetric Encryption
In asymmetric encryption we use 2 different keys;
One for encryption and one for decryption
Advantages
- You can give out your public key to anyone and it does not mean they'll be able to access the data post encryption
- Can be used to sign documents that prove it came from you (Digitally signed documents)
Disadvantages
- Requires a lot of CPU and memory resources
- The key is a lot bigger as well (AES 256 bit key is the equivalent of RSA 3072 bit key)
- Inefficient for large files (without splitting them up into smaller files)