cipher-d-cipher 2025
cipher-d-cipher 2025
Pratyush Sharma
Ryan Azim Shaikh
Cryptography
❖ Cryptography comes from the Greek words kryptós
meaning "hidden/secret" and graphein meaning
"writing".
❖ It is about constructing and analyzing protocols that
prevent third parties or the public from reading
private messages.
❖ Modern cryptography is heavily based on
mathematical theory and computer science.
Encryption and Decryption
❖ Data that can be read and understood without any
special measures is called plaintext.
❖ Disguising plaintext in such a way as to hide its
substance is called encryption.
❖ Encrypting plaintext results in unreadable gibberish
called cipher text.
❖ The process of reverting cipher text to its original
plaintext is called decryption.
Cipher
Examples:
❖ Plain text: abcdefghijklmnopqrstuvwxyz
❖ Cipher text: phqgiumeaylnofdxjkrcvstzwb
❖ Plain text: DEFEND THE EAST WALL OF THE CASTLE
❖ Cipher text: GIUIFG CEI IPRC TPNN DU CEI QPRCNI
Caesar’s Cipher
❖ It is a type of substitution cipher in which each letter in the
plaintext is 'shifted' a certain number of places down the
alphabet.
❖ If 'a'=0, 'b'=1, 'c'=2, ... , 'z'=25. We can now represent the
Caesar’s cipher encryption function, e(x), where x is the
character we are encrypting, as:
𝑒 𝑥 = 𝑥 + 𝑘 𝑚𝑜𝑑 26
where 𝑘 is the key (the shift) applied to each letter.
Keywords
❖ The cipher string can be generated using a keyword.
❖ For example, if the keyword were ‘Pratyush is God’
❖ Cipher Text: pratyushigodefjklmnqvwxzbc
❖ Often when two parties exchanged codes, they would
encode the first word using the cipher of the previous
day. This when decoded would give the keyword for the
rest of the message.
Affine Cipher
❖ It is a type of substitution cipher in which each letter in the plaintext is
‘multiplied’ by a number and then 'shifted' a certain number of places down the
alphabet.
❖ If 'a'=0, 'b'=1, 'c'=2, ... , 'z'=25. We can now represent the Affine cipher encryption
function, e(x), where x is the character we are encrypting, as:
𝑒 𝑥 = 𝑎𝑥 + 𝑘 𝑚𝑜𝑑 26
❖ If 'a'=0, 'b'=1, 'c'=2, ... , 'z'=25. We can now represent the Affine
cipher decryption function, d(x), where x is the character we are
decrypting, as:
𝑑 𝑥 = 𝑎−1 𝑥 − 𝑘 𝑚𝑜𝑑 26
where 𝑎 is a multiplicative factor, coprime with 26
k is the key (the shift) applied to each letter
and 𝑎−1 is the modular multiplicative inverse of a modulo 26,
i.e.,
1 = 𝑎𝑎−1 𝑚𝑜𝑑 26
Hill Cipher
❖ Hill Cipher uses matrix multiplication to cipher chunk of letters of size .
❖ Key for Hill cipher is a matrix of size 3*3.
❖ Blank spaces at the end of sentence in chunks are filled with infrequent letters such as X or Q.
❖ Example:
2 4 5
𝐾= 9 2 1
3 17 7
[A T T] = [0 19 19]
2 4 5 0 171 15
9 2 1 19 = 57 𝑚𝑜𝑑 26 = 5 = ‘PFO’
3 17 7 19 456 14
Atbash Cipher:
❖ A substitution cipher where the letters of the alphabet are reversed i.e. all
'A's are replaced with 'Z's, all 'B's are replaced with 'Y's, and so on.
❖ Example:
❖ Plain text: ATTACK AT DAWN
❖ Cipher text: ZGGZXP ZG WZDM
Transposition Cipher
❖ A method of encryption by which the positions held by units of plaintext are shifted according to a regular system
that is, the order of the units is changed.
❖ A simple example is to reverse the order of the letters in a plaintext. "a simple example" becomes "ELPMAXE ELPMIS A.”
❖ Another example consists of writing the text in chunks of 5 letters with one chunk below the other and reading
columnwise
MEETM
ESOON
Cipher Text: ME ES EO TO MN
Vigenère and AutoKey Ciphers
❖ In auto key cipher the key is not repeated but instead it is concatenated with the
plain text and then this is run all along the plain text, thus avoiding the
repetition.
❖ Example:
Plaintext: ATTACK AT D AWN…
Key: QUEENL YA T T ACK AT DAWN
Ciphertext: QNXEPV YT WT WP …
❖ First auto key cipher has defect that it did not use key but for all the letters in a
word the key character is the first letter of the word.
❖ Thus it was as difficult for the receiver as anyone else to decipher the cipher text.
❖ Notice how Vignère and AutoKey are different from Substitution codes, the
position of the character in a message matters.
Playfair Cipher
❖ The First practical "digraph" substitution cipher. Invented by Charles Wheatstone
but named after Lord Playfair who promoted the use of cipher.
❖ Start filling the key square by the key word and discard the letters which are
repeated and then fill the rest with the remaining letters in alphabetical order.
Example:
Digraph: HI
Playfair Cipher
Example:
Digraph: DE
Playfair Cipher
Example:
Digraph: EX