crypto
Introduction to Cryptography
6 min readNov 22, 2022
New blackfriday deal on Complete CompTIA Security Bundle — Security+, CySA+ & Pentest+ 99$ only, Coupon code for 10% off: _MXX
For more detailed information read Serious Cryptography: A Practical Introduction to Modern Encryption.
exit()
Hello everyone , from all the places around the world, I hope you are all great stay safe and read at home 😘
In this blog post i am going to introduce to you the fundamentals of cryptography and we will start with:
Encryption;
The types of cipher Encryption
Weak to strong Encryption
And randomizing Encryption or randomized encryption
Don’t worry if you don’t understand any concept now , i am assuming that you have no knowledge at all and you want to know about cryptography and this is my role to share with you the knowledge to help you achieve a good understanding of the Cryptography fundamentals.
So what is cryptography?
don’t misunderstand between cryptocurrency and cryptography its a different thing but there is a relationship in some parts but i am not going to talk about it because its not our topic.
Cryptography simply is a several methods and techniques used to secure texts or encrypts it through communication.
Now let’s start with the concept of Encryption:
Encryption is the principal application of Cryptography, It makes the data unreadable/incomprehensible to ensure its confidentiality.
The Encryption algorithm is equal to = Cipher
and
The Secret Value of it is = Key
##Note that without the secret key , You cannot decrypt nor get a drop of information from the encrypted data##
symmetric encryption
symmetric encryption: is a simple and weak kind of encryption , The key used to encrypt the message is the same as the key to decrypt.
Starting with the basics of encryption:
If we want to encrypt a message the plaintext refers as the UNENCRYPTED MESSAGE and CIPHER TEXT refers as the encrypted message, So therefor we have 2 functions of CIPHER , The Encryption which changes or turn a plaintext to a ciphertext and decryption which changes or turns ciphertext to a plaintext. Mostly when you see the word cipher in crypto they usually mean “Encryption”.
In this figure , it shows the basics of encryption and decryption.
For instance, E represents Encryption , D represents Decryption, C represents Output, K represents Key/Secret and P represents input/Plaintext.
We can write this relation as C = E(K, P) ; Output = Encryption(Key, Input)
Also keep in mind that Ciphers are the same size as plaintext or a little bit longer and its not possible to be shorter
Classical Cipher
Classical ciphers are ciphers that forego computers which means its homemade or by hands and it relies on letters rather than bits, Its easy to implement the encryption and decryption by hands , pen or both. This Kind of ciphers are really simpler than other new or modern once for instance , DES (3DES or TDES), Also the reason behind making this classical cipher is due to the old wars back into WW1, they cannot communicate with each other without a secret communication or message in addition there where no technologies or chips available that time.
The Caesar Cipher
The Caesar Cipher encryption works by shifting each letter of the message down by 3 of the English alphabet , Caesar Cipher can be easily decrypt simply be simple by shifting three positions back or down to retrieve the message/Plaintext
But is it that secure? No because simply by trying all the 25 possibilities the plain text will be revealed.
The Vigenère Cipher
Vigenère cipher, created in the 16th century by
an Italian named Giovan Battista Bellaso. The name “Vigenère” comes
from the Frenchman Blaise de Vigenère, who invented a different cipher
in the 16th century.
Vigenère Cipher is similar to the previous cipher Caesar , but the difference is instead of shifting 3 letters by 3 spaces it will be the number position of the letter in that alphabet , example: ABC >> 0,1,2
Lets take an example:
let’s say i want to encrypt a plaintext “This is a hash “ using KEY as = “MSEC”
Next we will take the text and at the bottom we will put the key:
T h i s i s a h a s h
m s e c m s e c m s e
now we are going to add the plaintext letter depending on the key below it
T + m = 19 + 12 = 31, which is = F , Now we have the first encrypted letter.
h + s = 7 + 18 = 25, which is = z and so on..
i + e = 8 + 4 = 12 , == M
you can refer to the formula that i have mentioned at the beginning and in this case for simplicity i have done it on this way.
Note: after adding the two letters if you get a number above the alphabet you are going to start again from the beginning like suppose we got 27, we will start counting 26 from A then B is 27.
Now in order to decrypt the cipher text we will use the same method but instead we will subtract.
PERMUTATION
classical ciphers works by substitution and there is a must to have permutation which is following a rule of re arrangement sequence of alphabet, For the shifting part you can use any alphabet for example Arabic letters not only that in addition you could use integers and ideograms such as Chinese characters.
For example: A,D,E and F discretely to F,D,A and E is permutation but if its A,D,E and F to F,F,D,E that’s not permutation because the letters are not mapping in each other.
Even though not every permutation is secure it has follow a certain criteria to enhance its security:
* Permutation should be determined by the key: If you don’t know the key it means you don’t know the 26 permutation that have been used, IN result you cant easily decrypt.
* Different keys should result in different permutations: If different key’s result in identical result of permutation that means less possibilities will be tried to decrypt without the need of the key, In the Vigenère
cipher, each letter from the key determines a substitution,
26 distinct letters and many distinct permutations.
* The permutation should look random
This means that cipher text should not be predictable or have a patter for example if we know that “A” encrypts to “H” this means that it shifts to 7 and then we will know that “i” will encrypts to “P” and so on. Yet, By using random permutations, Knowing that A encrypts to “H” will only tell that “i” does not encrypt to “H”.
If the permutation satisfies these criteria its a secure permutation, Even though permutation is necessary but at the same time its not sufficient by it self for building a secured cipher, We will also need a mode of operation to repeatedly support messages of any length.
I hope you enjoyed this post, Dont forget the like 😁 i tried to write it in a basic way so it be understood, If you want more parts on Cryptography comment down below ❤