Cryptography Tutorial | Part 1
Hi guys how are you? I hope you are fine in this topic we will talk about the Cryptography this field is a huge field we will split this field into parts of topics let's start.
In this part of the topic, we will talk about a simple algorithm in the Cryptography field it's Ceaser Cipher this algorithm is one of the old algorithms and the Ceaser king was use it in encrypt the messages, let's see how we can use this encryption.
Encryption:
we will imagen that we want to encrypt this word Hello to encrypt this word we should have the encryption key (k) let's imagine
gen that it's equal 3 so k=3 see this
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
we will found that every letter equal number we will use this equation
CipherText = E(k,p) = (p+k) mod 26
p is the letter place and k is the encryption & decryption key and 26 it's the number of English letters so this letter H after the encryption
H = E(3,7) = (3+7) mod 26 = 10
the number 10 is equal K from the above sequence if we try to encrypt this letter E
E = E(3,4) = (3+4) mod 26 = 7
so the number 7 is equal H from the above sequence so if we do this operation with other letters on this word Hello we can see that this is the encryption of this word KHOOR now we finish this part let's see the Decryption process.
E = E(3,4) = (3+4) mod 26 = 7
so the number 7 is equal H from the above sequence so if we do this operation with other letters on this word Hello we can see that this is the encryption of this word KHOOR now we finish this part let's see the Decryption process.
---------------------------------------------------
Decryption:
after the encryption process come to the decryption process in this process we will use this equation
PlainText = D(k,p) = (p-k) mod 26 where p > k
Or
PlainText = D(k,p) = (k-p) mod 26 where k > p
let's decrypt this KHOOR and we will use the same key (k=3) when we see the above sequence we can notice that the K letter is equal number 10 so
K = D(k,p) = (10-3) mod 26 = 7
the number 7 is equal H letter so let's try H letter which equal number 7
k = D(k,p) = D(10-7) mod 26 = 4
K = D(k,p) = (10-3) mod 26 = 7
the number 7 is equal H letter so let's try H letter which equal number 7
k = D(k,p) = D(10-7) mod 26 = 4
so the number 4 equal E letter, if we do the same process with the other encrypted letters we finally can see the output which will be HELLO so this is the topic today I hope its useful to you thank you for reading.
Comments
Post a Comment