An Introduction to
Cryptography
Instructor: Mohsin Ali
TABLE OF CONTENTS
03
Cryptography 01
02
Ciphers
Algorithms
Substitution Ciphers
Ceaser Cipher
Play fair Cipher
Hill Cipher
Homophonic Substitution
Affine Cipher
Atbash Cipher
Multi- Alphabet Substitution
Transposition Ciphers
Reverse Order
Rail fence Cipher
Columnar Cipher
Vernam Cipher
Book Cipher
AES
DES
RSA
ECC
History
Cryptography Techniques
Types of Cryptography
Basic Terms
Encryption & Decryption
Types of Encryption
Cryptography
01
What is Cryptography???
Crypt
The term "crypt" originates from the Greek word "kryptos,"
meaning "hidden" or "secret." In the context of cryptography and
related fields, "crypt" typically refers to the concept of secrecy,
confidentiality, or hidden communication. It is often used as a
prefix in words related to encryption, decryption, and secure
communication.
Cryptography is the practice of protecting information by
transforming it into an unreadable format, ensuring its confidentiality
and integrity. It's like building a secret code that only authorized
individuals can crack. It encompasses both encryption and decryption
processes.
Cryptography includes encryption as one of its
fundamental components. However, cryptography also
encompasses other aspects such as hashing, digital
signatures, and key exchange protocols.
Cryptography
Basic Terminologies
Cipher: A synonym for the algorithm used in transforming plaintext to cipher text.
Cipher text: The coded or encrypted message. If your encryption is sufficiently strong,
your cipher text should be secure.
Decipher (decrypt): Decipher and decrypt are synonyms. Both terms mean to convert
the cipher text to plaintext.
Encipher (encrypt): Encipher and encrypt are synonyms. Both words mean to convert the
plaintext into cipher text.
Key: The information, usually some sort of number, used with the algorithm to encrypt
or decrypt the message. Think of the key as the fuel the algorithm requires in order to
function.
Key space: The total number of possible keys that could be used. For example, DES uses
a 56-bit key; thus, the total number of possible keys, or the key space, is 256.
Plaintext: The original message—the information you want to secure.
Basic Terminologies
Cryptanalysis:
Cryptanalysis is the study of analyzing and breaking cryptographic algorithms and
systems to uncover hidden information or plaintext without knowledge of the
cryptographic key. It involves various techniques, including frequency analysis, brute-
force attacks, and mathematical analysis, to decipher encrypted messages.
Cryptology:
Cryptology is the broader field encompassing both cryptography and cryptanalysis. It
deals with the study of techniques for secure communication and data protection,
including the design, analysis, and implementation of cryptographic algorithms and
protocols.
Basic Terminologies
Cryptogram:
A cryptogram is a type of puzzle or game where a piece of text is encoded using a
substitution cipher or other cryptographic technique, and the goal is to decipher the
original message.
Cryptosystem:
A cryptosystem is a set of cryptographic algorithms and protocols used for encryption,
decryption, and secure communication. It includes components such as encryption
algorithms, cryptographic keys, key management systems, and communication protocols
to ensure the confidentiality, integrity, and authenticity of data.
Cryptocurrency:
A cryptocurrency is a digital or virtual currency that uses cryptographic techniques to
secure financial transactions, control the creation of new units, and verify the transfer of
assets. Examples include Bitcoin, Ethereum, and Litecoin.
History of Cryptography
History of Cryptography
 As civilizations evolved, human beings got organized in tribes, groups, and
kingdoms.
 This led to the emergence of ideas such as power, battles, supremacy, and politics.
 These ideas further fueled the natural need of people to communicate secretly with
selective recipient which in turn ensured the continuous evolution of cryptography
as well.
 The roots of cryptography are found in Roman and Egyptian civilizations
 The first known evidence of cryptography can be traced to the use of ‘hieroglyph’.
 Some 4000 years ago, the Egyptians used to communicate by messages written in
hieroglyph
Symmetric Cryptography: In symmetric cryptography, the same
key is used for both encryption and decryption. Examples include
classical ciphers like the Caesar cipher and modern block ciphers
like the Data Encryption Standard (DES).
Asymmetric Cryptography: Asymmetric cryptography
uses a pair of keys (public and private) for encryption and
decryption. Examples include the Diffie-Hellman key
exchange and public-key encryption algorithms like RSA.
Types of Cryptography
What is Encryption???
Transforming data into an unreadable format using a specific
algorithm and key.
Process:
Plaintext: Original, readable data.
Encryption Algorithm: Mathematical formula that scrambles the
data.
Ciphertext: Encrypted, unreadable data.
Key: Secret element used to control the encryption and decryption
process.
Encryption acts as a digital shield, transforming information into an
unreadable form, rendering it unintelligible to anyone without the
decryption key. This process involves applying an algorithm and a
secret key to scramble the data, ensuring its confidentiality.
Encryption
Purpose of Encryption: Encryption ensures data
confidentiality by protecting sensitive information
from unauthorized access. It also helps maintain
data integrity and authenticity during transmission
and storage.
.
Encryption is the process of converting plaintext
into ciphertext, making it unreadable to
unauthorized users. It uses an algorithm and a key
to scramble the data.
Encryption
Symmetric Encryption: Uses a single key for both
encryption and decryption. Examples include Data
Encryption Standard (DES) and Advanced Encryption
Standard (AES).
. Asymmetric Encryption: Uses a pair of keys (public and
private) for encryption and decryption. Examples
include Rivest-Shamir-Adleman (RSA) and Elliptic Curve
Cryptography (ECC).
Types of Encryption
What is Decryption???
The process of reversing encryption, transforming ciphertext back
to its original plaintext form.
Requires:
Ciphertext: The encrypted data.
Decryption Algorithm: The same algorithm used for encryption.
Key: The same secret key used for encryption.
Decryption is the counterpart of encryption, responsible for
unlocking the scrambled data and retrieving the original message. It
utilizes the same algorithm and decryption key employed during
encryption, enabling authorized recipients to access the
confidential information.
Decryption
Decryption is the reverse process of encryption,
where ciphertext is converted back to plaintext using
the appropriate decryption key. Secure management
of decryption keys is crucial to prevent unauthorized
access to encrypted data. The purpose of decryption is to allow authorized users
or systems to access and interpret the encrypted data.
Without decryption, the encrypted data remains
unreadable and unusable to anyone who does not
possess the appropriate decryption key or algorithm.
Decryption
Ciphers
02
Substitution Cipher
A substitution cipher substitutes one symbol with another. If the symbols in the
plaintext are alphabetic characters, we replace one character with another.
For example, we can replace character A with D, and character T with Z. If the symbols
are digits (0 to 9), we can replace 3 with 7, and 2 with 6.
Substitution ciphers can be categorized as either monoalphabetic or polyalphabetic
ciphers.
Monoalphabetic Cipher
In a monoalphabetic cipher, a character (or a symbol) in the plaintext is always changed
to the same character (or symbol) in the Ciphertext regardless of its position in the text.
For example, if the algorithm says that character A in the plaintext is changed to
character D, every character A is changed to character D. In other words, the relationship
between characters in the plaintext and the Ciphertext is a one-to-one relationship.
The following shows a plaintext and its corresponding ciphertext. Is the cipher
monoalphabetic?
Plaintext: HELLO
Ciphertext: KHOOR
Polyalphabetic Cipher
In a polyalphabetic cipher, each occurrence of a character can have a different
substitute. The relationship between a character in the plaintext to a character in the
ciphertext is a one-to-many relationship.
For example, character A could be changed to D in the beginning of the text, but it could
be changed to N at the middle. It is obvious that if the relationship between plaintext
characters and ciphertext characters is one-to many, the key must tell us which of the
many possible characters can be chosen for encryption.
To achieve this goal, we need to divide the text into groups of characters and use a set of
keys.
The following shows a plaintext and its corresponding ciphertext. Is the cipher mono
alphabetic?
Plaintext: HELLO
Ciphertext: ABNZF
Ceaser Cipher
 The Caesar cipher, also known as Caesar's shift or Caesar's code, is one of the
earliest and simplest encryption techniques.
 The Caesar Cipher works by shifting each letter in the plaintext message a certain
number of positions down or up the alphabet.
 For example, let's use a shift value of 3.
 Replace each letter in the plaintext message with the letter that is three positions
down the alphabet.
 Wrap around to the beginning of the alphabet if necessary.
 For example, using a Caesar Cipher with a shift value of 3:
 Plaintext: "HELLO"
 Encrypted: "KHOOR"
Ceaser Cipher
Ceaser Cipher Practice
Using a shift cipher with a key of
3, encrypt the following
: PT:"ENCRYPT THIS MESSAGE.””
CT:????
Using a shift cipher with a key
of 2, Decrypt the following.
CT: “JGNNQ YQTNF”
PT: ???
Mathematical Notation for Ceaser Cipher
For Encryption
C = P + K = (mod 26)
letter C to represent cipher text.
letter P to represent plaintext
letter K to represent the key.
For Decryption
P = C + K (mod 26)
Atbash Cipher
The Atbash Cipher is a monoalphabetic substitution cipher that uses a simple
algorithm where each letter in the plaintext is replaced with its corresponding letter
from the reverse of the alphabet. It was used in ancient times and is one of the simplest
types of substitution ciphers.
How the Atbash Cipher Works
 Take the alphabet (A-Z for English) and reverse it:
 Normal Alphabet: 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
 Reverse Alphabet: Z Y X W V U T S R Q P O N M L K J I H G F E D C B A
 Substitute each letter in the plaintext with its counterpart in the reversed alphabet:
 A becomes Z, B becomes Y, C becomes X and so on.
 Non-alphabetic characters such as numbers, punctuation, and spaces are usually left
unchanged.
Encryption:
Plain text: DESIGN Cipher text: WVHRTM
Decryption:
Cipher Text: ZGYZHS Plain Text: ????
For Practice
Plain Text: Cryptography is Fun! Cipher Text: ???
Affine Cipher
The Affine Cipher is a type of monoalphabetic substitution cipher that combines both
multiplication and addition to encode letters. It is more complex than the Atbash cipher
and uses a mathematical formula to perform encryption and decryption.
How the Affine Cipher Works
The encryption and decryption are based on the following formulae:
Encryption Formula: E(x) = ax + b (mod m)
x: Position of the plaintext letter in the alphabet (starting from 0 for A, 1 for B, ..25 for
Z).
a: Multiplicative key (must be coprime with m, i.e., gcd(a, m) = 1).
b: Additive key.
m: Size of the alphabet (26 for English).
E(x): Position of the cipher text letter.
Decryption Formula: D(y)=a-¹ (y b)mod m
⋅ −
y: Position of the ciphertext letter.
a¹: Modular multiplicative inverse of a(i.e., a a 1mod m=1
⋅ −
Key Requirements
The key pair is (a,b)(a, b)(a,b), where:
a must be coprime with m.
b is any integer between 0 and m 1. (0 to 25)
−
Affine Cipher
Steps to Encrypt and Decrypt
Convert each letter in the plaintext to its numerical equivalent (A=0, B=1, ..., Z=25).
Apply the encryption formula to find the cipher text letter.
For decryption, apply the decryption formula to revert to the plaintext letter.
Map the numerical results back to their corresponding letters.
Example 1: Encryption
Plaintext: HELLO
Key: a=5, b=8.
Encryption Formula: E(x)=(ax+b)mod 26
Convert letters to numbers:
H 7, E 4, L 11, L 11, O 14.
→ → → → →
Apply E(x) to each letter:
H (7): (5 7+8)mod 26=43mod 26=17 R
⋅ →
E (4): (5 4+8)mod 26=28mod 26=2 C
⋅ →
L (11): (5 11+8)mod 26=63mod 26=11 L
⋅ →
L (11): (5 11+8)mod 26=63mod 26=11 L
⋅ →
O (14): (5 14+8)mod 26=78mod 26= 0 A
⋅ →
Cipher text: RCLLA
Decryption: ???
Rot 13
The ROT13 (Rotate by 13) cipher is a simple substitution cipher where each letter of the
alphabet is shifted 13 places forward in the alphabet. It is a special case of the Caesar
cipher with a fixed shift of 13 characters. Each letter in the alphabet has a numeric
position.
A = Position 1, B = Position 2, C = Position 3 and so on Z = Position 26.
Because the English alphabet contains 26 letters, ROT13 is its own inverse—applying the
ROT13 transformation twice restores the original text.
Rot 13
Formula for ROT13 Encryption and Decryption
For a given letter x: X denotes P.T, Y denotes C.T.
Encryption: E = (P + 13) mod 26
Decryption: D = (C 13) mod 26
−
Encryption
Plain Text: Power
Cipher Text: ??
Decryption
Cipher Text: MNGBBA
Plain Text: ???
Vigenère Cipher
Vigenère Cipher
The Vigenère Cipher is a type of multi-alphabet substitution cipher that encrypts text
by using a series of different Caesar ciphers based on a keyword. It was invented by
Giovan Battista Bellaso in 1553 and is named after Blaise de Vigenère.
The Vigenère Cipher was historically considered unbreakable due to its use of multiple
shifting alphabets, and it remained widely used until the 19th century.
How It Works
The cipher uses:
Plaintext: The original message to encrypt.
Key: A repeated sequence of letters or a keyword to determine the shifting of the
alphabets.
Vigenère Table (or Square): A 26x26 grid of alphabets, where each row represents a
Caesar cipher shifted by one position. (A=0, B=1,,,, Z=25)
 Encryption
 P+K mod 26
 Decryption
 C-K mod 26
Vigenère Cipher
Polybius Square
The Polybius cipher is a 2-dimensional substitution cipher that maps each letter to a
pair of numbers based on its position in a 5×5 grid (a table of the alphabet). It is a
classical cipher that was used in ancient times, particularly by the Greeks.
The Polybius square only contains the 25 letters of the alphabet, where 'I' and 'J' are
often combined to form a single cell in the grid.
Polybius Square Setup
Step 1: Create the 5×5 Grid
• Each row and column is numbered from 1 to 5.
• For example:
• The letter A is in position (1,1).
• The letter E is in position (1,5).
• The letter J is usually combined with I and placed in the same cell.
Each letter corresponds to its row and column number.
For example:
A → (1,1) Code
→ 11
E → (1,5) Code
→ 15
Polybius Square
Encrypting the Word "HELLO"
Let's encrypt the word "HELLO" using the Polybius
cipher.
Step 1: Locate the letters in the 5×5 grid
Step 2: Replace each letter with its code
The word "HELLO" becomes "23 15 31 31 34".
Decrypting the Code "23 15 31 31 34"
Let's decrypt the code "23 15 31 31 34" by
converting each pair back to its letter:
So, "23 15 31 31 34" decrypts to "HELLO".
For Practice:
Encryption
Plain Text: JUMP
Code:???
Decryption
Code: 42 15 24 32 15.
Plain text: ???
Multi-Alphabet Substitution Cipher
Multi-Alphabet Substitution Cipher
The Multi-Alphabet Substitution Cipher is an encryption method that uses multiple
substitution alphabets to encode a message. Unlike a simple substitution cipher (where
each letter is replaced by one fixed substitute), multi-alphabet substitution ciphers vary
the substitution throughout the text, making them more resistant to frequency analysis
attacks.
One of the most famous examples of a multi-alphabet cipher is the Vigenère Cipher.
How It Works
In multi-alphabet substitution:
Multiple Alphabets: Use several substitution alphabets instead of just one.
For example, you could shift letters by 3 in one alphabet, 5 in the next, and so on.
Key: A key determines which substitution alphabet to use for each letter in the plaintext.
Pattern: The pattern of substitution repeats based on the length of the key.
Play fair cipher
The Play fair Cipher is a manual symmetric encryption technique that operates on pairs
of letters rather than individual characters. It was invented in 1854 by Charles
Wheatstone but was named after Lord Play fair, who promoted its use.
Key Components:
Key Square: A 5x5 grid filled with the letters of the alphabet (often with 'I' and 'J'
combined). The key or keyword is placed in the grid first, followed by the remaining
letters in alphabetical order.
Digraphs: The plaintext message is divided into pairs of letters (digraphs). If a pair
consists of repeated letters, a filler letter like 'X' is added between them. If the message
has an odd number of letters, a filler letter is added at the end.
Encryption Rules:
Same Row: If both letters of a digraph are in the same row of the key square, replace
each letter with the letter to its immediate right. The rightmost letter wraps around to
the leftmost position.
Same Column: If both letters of a digraph are in the same column, replace each letter
with the letter immediately below it. The bottommost letter wraps around to the
topmost position.
Different Row and Column: If the letters are in different rows and columns, form a
rectangle with the two letters. Replace each letter with the letter at the opposite corner
of the rectangle.
Playfair Cipher
Plain Text: Attack at dawn
Keyword: Falcon
Cipher Text: ???
Use Book(Modern Cryptography) to see the solution
For Practice
Key: PLAYFAIREXAMPLE Plaintext: "HIDE THE GOLD IN THE TREE STUMP"
Prepare the plaintext: "HIDEXTHEGOLDINTHEXTREESTUMP"
Create the key square:
Hill Cipher
The Hill Cipher is a polygraphic substitution cipher based on linear algebra. It was
invented by Lester S. Hill in 1929 and is one of the earliest ciphers to use mathematical
operations for encryption and decryption.
Key Concepts of Hill Cipher:
Matrix-Based Encryption:
The Hill Cipher uses a matrix of size n × n as the encryption key.
Both the plaintext (in blocks of size n) and the key are represented as matrices over a
finite field (typically modulo 26 for the English alphabet).
Encryption Process:
Convert plaintext into numerical form (A = 0, B = 1, ..., Z = 25).
Break the plaintext into blocks of size n.
Multiply each plaintext block (vector) by the key matrix.
Compute the modulo operation to ensure the result is within the valid range of
alphabetic characters.
Convert the resulting numerical values back to letters.
Formula for Encryption:
C=(K P)mod 26
⋅
Hill Cipher
Example:
1. Key Matrix (2×2):
2. K=[]
3. Plaintext (2-letter blocks): "HI“ (78)
Numerical equivalent: P=[
4. Encrypt:
C=(K P)mod 26
⋅
C= [ [ 26
⋅
C= mod 26
C=[
C=
Transposition Techniques
Transposition technique is an encryption method which is achieved by performing
permutation over the plain text. Mapping plain text into cipher text using transposition
technique is called transposition cipher.
Reverse Order
Rail Fence Transposition
Columnar Transposition
Running Key Cipher
One Time Pad
Reverse Order
The Reverse Order Cipher Technique is a simple and basic transposition cipher where
the plaintext is encrypted by reversing the order of its characters. This technique does
not substitute characters but instead rearranges their positions. It is one of the easiest
forms of encryption.
Steps for Reverse Order Cipher:
Write the Plaintext: Start with a plaintext message.
Example: SECRET MESSAGE
Reverse the Order: Write the characters in reverse order to form the ciphertext.
Cipher text: EGASSEMTERCES
Decryption: The decryption process is the same—reverse the order of the ciphertext to
retrieve the plaintext.
Example:
Plaintext: KEEP IT SIMPLE
Cipher text: ELPMISTIPEEK
Rail Fence Cipher
The rail fence cipher is the simplest transposition cipher. The steps to obtain cipher text
using this technique are as follow:
Step 1: The plain text is written as a sequence of diagonals.
Step 2: Then, to obtain the cipher text the text is read as a sequence of rows.
Plain Text: meet me Tomorrow
Cipher Text: M E M T M R O E T E O O R W
Columnar Transposition Technique
A Columnar Cipher is a transposition cipher that rearranges the characters of plaintext based on a
predefined key, which determines the order of the columns. The cipher text is created by writing the
plaintext in rows under the key and then reading the columns in the order specified by the key.
Steps in Columnar Cipher:
Choose a Key:
The key is a word or sequence that determines the columnar arrangement. Each letter in the key is
assigned a number based on its alphabetical order. For example, key ‘DESIGN’ D(1) E(2) S(6) I(4) G(3) N(5)
Write Plaintext in Rows:
Write the plaintext beneath the key in rows of equal length (pad with filler characters if necessary).
Example: Plaintext: Secure Your Data Now
Key: DESIGN (1 2 6 4 3 5 )
Arranged as:
S E C U R E
Y O U R D A
T A N O W X
(Note: "X" is used as a padding character to fill the table).
Read Columns in Key Order:
Read the columns based on the numerical order of the key letters. Using the above key D(1) E(2) S(6) I(4)
G(3) N(5)
Column order: 1 2 6 4 3 5
→ → → → →
Cipher text: SYT EOA EAX URO CUN RDW
One Time Pad
The One-Time Pad (OTP) Cipher is an encryption technique that is theoretically
unbreakable when implemented correctly. The OTP Cipher also called the Vernam Cipher
It uses a random, one-time-use key that is as long as the plaintext message. The key is
combined with the plaintext to produce the cipher text.
Key Generation:
The key must be completely random, truly unpredictable, and at least as long as the
plaintext.
The key is used only once, hence the name "One-Time Pad."
Encryption:
Each character of the plaintext is combined with the corresponding character of the key
using modular arithmetic.
For letters, modular arithmetic is used:
Cipher text Character= (Plaintext Character + Key Character) mod 26
Decryption:
The cipher text is combined with the same key to retrieve the plaintext.
For letters: Plaintext Character=(Cipher text Character Key Character)mod 26
−
One Time Pad
For Alphabetic Data:
Plaintext: HELLO
Key: XMCKL (random key of the same length)
Convert letters to numbers: A=0,B=1,…,Z=25
Plaintext: H=7,E=4,L=11,L=11,O=14 Key: X=23,M=12,C=2,K=10,L=11
Encryption: Cipher text=(Plain text+ Key)mod 26
7+23=30mod 26=4(E) , 4+12=16(Q) , 11+2=13(N) ,
11+10=21(V) ,14+11=25(Z)
Cipher text: EQNVZ
For Practice
P.T: PERFECT
Key(OTP): WHITE (if key length is short then repeat the same key until the plaintext
space is filled.
Cipher text:???
Running Key Cipher
The Running Key Cipher, also known as the Autokey Cipher or Book Cipher, is a
variation of the Vigenère Cipher. It uses a long, predetermined text (such as a book,
poem, or passage) as the encryption key. The plaintext and key text are combined in a
character-by-character fashion to produce the cipher text.
Key Selection:
A long text, often publicly available, is chosen as the key.
Both the sender and receiver agree on this key text and know the exact starting point
within it.
Encryption:
Each character of the plaintext is paired with a corresponding character from the key
text.
The two characters are then combined using modular arithmetic (often modulo 26 for
English alphabets).
For example: Cipher text Character=(Plaintext Character + Key Character)mod 26
Decryption:
The receiver retrieves the key text and uses it to reverse the encryption process.
The cipher text is paired with the same key text to recover the plaintext:
Plaintext Character=(Cipher text Character Key Character)mod 26
−
Running Key Cipher
How it works:
Step 1: Convert the plain text in numeric form consider A=0, B=1, C=3 …, Z=25.
Step 2: Take an onetime pad or key from any of the books and convert it in the numeric
form also. But the key must be as long as the length of plain text.
Step 3: Now add the numeric form of both plain text and key, each plain text letter with
corresponding key text letter. If the addition of any plain text letter with corresponding
key text letter is >26, then subtract it with 26.
Plaintext: HELLO
Key Text: A long text starting with "WORLD"
Convert letters to numbers: A=0,B=1,…,Z=25
Plaintext: H=7, E=4, L=11, L=11, O=14
Key: W=22, O=14, R=17, L=11, D=3
Cipher text=(Plaintext+ Key)mod 26
7+22=29mod 26=3(D)
4+14=18(S)
11+17=28mod 26=2(C)
11+11=22(W)
14+3=17(R)
Cipher text: DSCWR
Symmetric Key Cryptography
Symmetrical Key Cryptography also known as conventional or single-key encryption was
the primary method of encryption before the introduction of public key cryptography in
the 1970s. In symmetric-key algorithms, the same keys are used for data encryption and
decryption. This type of cryptography plays a crucial role in securing data because the
same key is used for both encryption and decryption.
Techniques Used in Symmetric Key Cryptography
Substitution and Transposition are two principal techniques used in symmetric-key
cryptography.
Substitution Techniques
The symmetric key cryptographic method employs one secret key for the operations of
encryption and decryption. Substitution techniques provide two significant approaches,
wherein elements (letters, characters) from the plaintext message are replaced with new
elements according to the rules based on the secret key. For Example Ceaser Cipher, Hill
Cipher, Play Fair Cipher, Monoalphabetic Cipher, Polyalphabetic Cipher, Vigenere Cipher.
Transposition Techniques
Transposition techniques rearrange the order of elements in the plaintext message
without changing the elements themselves. Reverse Order, Rail Fence Cipher, Columnar
Cipher, Book Cipher, Vernam Cipher.
Types of Symmetric Key Cryptography
There are two types of Symmetric Key Cryptography.
Stream Cipher
The encryption process begins with the stream Cipher algorithm generating a pseudo-
random keystream made up of the encryption key and the unique randomly generated
number known as the nonce. The result is a random stream of bits corresponding to the
length of the ordinary plaintext. Then, the ordinary plaintext is also deciphered into
single bits.
These bits are then joined one by one to the keystream bits, gradually converting the
ordinary plaintext into the cipher text using the XOR bitwise operations.
The most common stream cipher algorithms are RC4, Salsa-20, Grain-128 etc.
Block Cipher
The result of a block cipher is a sequence of blocks that are then encrypted with the key.
The output is a sequence of blocks of encrypted data in a specific order. When the cipher
text travels to its endpoint, the receiver uses the same cryptographic key to decrypt the
cipher text block chain to the plaintext message.
The most common stream cipher algorithms are DES, AES etc.
Block Cipher
A Block Cipher is a method of encrypting data in fixed-size blocks, typically of 64 or 128
bits. In this process, plaintext data is divided into equal-sized blocks, and each block is
independently encrypted into cipher text using a specific algorithm and a secret key. If
the plaintext data is not a multiple of the block size, padding is added to the last block
to make it the correct size.
Key Features:
Fixed Block Size: Operates on a fixed number of bits per block.
Symmetric Key Algorithm: Uses the same key for both encryption and decryption.
Deterministic Nature: For the same input block and key, it produces the same output
block.
Examples of Block Ciphers:
DES (Data Encryption Standard): Uses 64-bit blocks with a 56-bit key.
AES (Advanced Encryption Standard): Supports 128, 192, or 256-bit keys with 128-bit
blocks.
Blowfish: Uses variable-length keys (up to 448 bits) and 64-bit blocks.
Block Cipher
Feistel Cipher
The Feistel cipher is a symmetric structure used in the design of block ciphers, named
after Horst Feistel, who developed it while working at IBM in the early 1970s. The
structure is widely used in cryptographic algorithms like DES (Data Encryption
Standard), Blowfish, and Twofish.
Key Features of a Feistel Cipher:
Block Cipher:
Operates on fixed-size blocks of data, such as 64-bit or 128-bit blocks.
Divides each block into two equal halves (left and right).
Iterative Rounds:
Data is processed through multiple rounds (e.g., 16 rounds in DES).
Each round uses a subkey derived from the main key.
Structure:
Each block is split into two halves: L0L_0L0​(Left) and R0R_0R0​(Right).
In each round:
Li+1= Ri
Ri+1=Li F (Ri,Ki) ·
·
F is a round function (e.g., substitution, permutation, or other complex operations).
Ki​is the round-specific subkey.
⊕ represents the XOR operation.
Feistel Cipher
What is Steganography???
The art and science of hiding information within a
cover medium, such as an image, audio, or video
file.
Goal: Conceal the existence of the hidden message.
Steganography takes a different approach to information
security. Unlike encryption, which scrambles data,
steganography aims to hide the message itself within
another seemingly harmless carrier file. This technique
conceals the very existence of the hidden information,
making it even more challenging to detect.
Steganography
Cryptographic
Algorithms
03
DES???
DES
Data Encryption Standard (DES)
The Data Encryption Standard (DES) is a symmetric key block cipher widely used for
encryption. It was developed in the 1970s and standardized by NIST (National Institute
of Standards and Technology). DES encrypts data in blocks of 64 bits using a 56-bit key.
Features:
 Encryption/Decryption Algorithm (P.T C.T)
 DES is a block Cipher
 Input and Output Size is 64 bit.
 16 rounds
 Initial Key size is 64 bit but after discard the initial permutation we remove the 8 bits
by the 8th
bit. Like 8×1= 8, 8×2= 16, 8×3= 24, 8×4= 32, 8×5= 40, 8×6= 48, 8×7= 56,
8×8= 64.
 After Removing 8 bits key size is 56.
 Now divide the 56 bits into two equal halves 28+28 =56.
 Left Circular Shift depend on the round number if the round is 1, 2, 9 and 16 then we
shift the 1(one) bit.
 Every round the 48 bit key is different.
DES
2 DES
Two Data Encryption Standard (2DES)
2DES Algorithm (Double DES) is an extension of the original DES algorithm that was
designed to improve its security. It applies the DES algorithm twice using two different
keys to mitigate brute-force attacks.
Key Features:
Input: Two different 56-bit keys (Key1 and Key2) are used.
Double Encryption: Plaintext is encrypted twice using DES.
Output: The resulting cipher text has an increased level of security (compared to single
DES)
3 DES
Triple Data Encryption Standard (3DES)
Triple DES (3DES) is an improved version of the original DES algorithm that applies the
encryption process three times using either two or three different keys. It was designed
to address the security weaknesses of single DES, especially against brute-force attacks.
Key Features
Multiple Keys:
Option 1: Two keys (Key1 and Key2) are used.
Option 2: Three keys (Key1, Key2, and Key3) are used for stronger security.
Triple Encryption:
Data is encrypted, decrypted, and then encrypted again.
Increased Key Size:
Using three 56-bit keys makes the effective key size 168 bits (or 112 bits in the case of
two keys).
AES???
AES
 Advanced Encryption Standard (AES) is an encryption standard adopted by the U.S.
government.
 Most Strongest Algorithm ever symmetric key block cipher. Same key is used for
encryption and decryption.
 The AES Encryption algorithm (also known as the Rijndael algorithm)
 The standard comprises three block ciphers, AES-128, AES-192 and AES-256, adopted
from a larger collection originally published as Rijndael.
 Each AES cipher has a 128-bit block size, with key sizes of 128, 192 and 256 bits,
respectively. The Structure is based on the Substitution-permutation network.
 The AES ciphers have been analyzed extensively and are now used worldwide, as was
the case with its predecessor, the Data Encryption Standard (DES).
AES
Advanced Encryption Standard (AES) is an encryption standard adopted by the U.S.
government. Most Strongest Algorithm ever symmetric key block cipher. Same key is
used for encryption and decryption. The AES Encryption algorithm (also known as the
Rijndael algorithm)
Key Sizes: Supports 128-bit, 192-bit, and 256-bit keys.
· Block Size: Operates on fixed 128-bit blocks of data.
· Symmetric Encryption: Uses the same key for both encryption and decryption.
·
Rounds:
10 rounds for 128-bit keys.
12 rounds for 192-bit keys.
14 rounds for 256-bit keys.
 The Structure is based on the Substitution-permutation network.
 The AES ciphers have been analyzed extensively and are now used worldwide, as was
the case with its predecessor, the Data Encryption Standard (DES).
Asymmetric/Public Key Cryptography???
Public Key Cryptography
 Unlike symmetric key cryptography, we do not find historical use of public-key
cryptography.
 It is a relatively new concept.
 Symmetric cryptography was well suited for organizations such as governments,
military, and big financial corporations were involved in the classified
communication.
 With the spread of more unsecure computer networks in last few decades, a genuine
need was felt to use cryptography at larger scale.
 The symmetric key was found to be non-practical due to challenges it faced for key
management.
 This gave rise to the public key cryptosystems.
Public Key Cryptography
Mechanism of public key cryptography.
Public Key Cryptography
 The most important properties of public key encryption scheme are −
 Different keys are used for encryption and decryption. This is a property which set
this scheme different than symmetric encryption scheme.
 Each receiver possesses a unique decryption key, generally referred to as his private
key.
 Receiver needs to publish an encryption key, referred to as his public key.
 Some assurance of the authenticity of a public key is needed in this scheme to avoid
spoofing by adversary as the receiver. Generally, this type of cryptosystem involves
trusted third party which certifies that a particular public key belongs to a specific
person or entity only.
RSA???
RSA
 The system was invented by three scholars Ron Rivest, Adi Shamir, and Len
Adleman
 Hence, it is termed as RSA cryptosystem.
 Public, Private Key Encryption and Decryption
Generation of Key Pair
Each person or a party who desires to participate in communication using encryption
needs to generate a pair of keys, namely public key and private key.
The process followed in the generation of keys is described below −
Generate the RSA modulus (n)
Select two large primes, p and q.
Calculate n=p*q. For strong unbreakable encryption, let n be a large number, typically a
minimum of 512 bits.
Find Derived Number (e)
Number e must be greater than 1 and less than (p 1)(q 1).
− −
There must be no common factor for e and (p 1)(q 1) except for 1. In other words
− −
two numbers e and (p – 1)(q – 1) are coprime
Generation of Key Pair
Form the public key
 The pair of numbers (n, e) form the RSA public key and is made public.
 Interestingly, though n is part of the public key, difficulty in factorizing a large prime
number ensures that attacker cannot find in finite time the two primes (p & q) used to
obtain n. This is strength of RSA.
 Generate the private key
 Private Key d is calculated from p, q, and e. For given n and e, there is unique number
d.
 Number d is the inverse of e modulo (p - 1)(q – 1). This means that d is the number
less than (p - 1)(q - 1) such that when multiplied by e, it is equal to 1 modulo (p - 1)(q -
1).
 This relationship is written mathematically as follows −
 ed = 1 mod (p 1)(q 1)
− −
Generation of Key Pair
RSA Encryption/Decryption
Trust Policy
Thanks

4.IS@Mohsin.pptx........................

  • 1.
  • 2.
    TABLE OF CONTENTS 03 Cryptography01 02 Ciphers Algorithms Substitution Ciphers Ceaser Cipher Play fair Cipher Hill Cipher Homophonic Substitution Affine Cipher Atbash Cipher Multi- Alphabet Substitution Transposition Ciphers Reverse Order Rail fence Cipher Columnar Cipher Vernam Cipher Book Cipher AES DES RSA ECC History Cryptography Techniques Types of Cryptography Basic Terms Encryption & Decryption Types of Encryption
  • 3.
  • 4.
  • 5.
    Crypt The term "crypt"originates from the Greek word "kryptos," meaning "hidden" or "secret." In the context of cryptography and related fields, "crypt" typically refers to the concept of secrecy, confidentiality, or hidden communication. It is often used as a prefix in words related to encryption, decryption, and secure communication.
  • 6.
    Cryptography is thepractice of protecting information by transforming it into an unreadable format, ensuring its confidentiality and integrity. It's like building a secret code that only authorized individuals can crack. It encompasses both encryption and decryption processes. Cryptography includes encryption as one of its fundamental components. However, cryptography also encompasses other aspects such as hashing, digital signatures, and key exchange protocols. Cryptography
  • 7.
    Basic Terminologies Cipher: Asynonym for the algorithm used in transforming plaintext to cipher text. Cipher text: The coded or encrypted message. If your encryption is sufficiently strong, your cipher text should be secure. Decipher (decrypt): Decipher and decrypt are synonyms. Both terms mean to convert the cipher text to plaintext. Encipher (encrypt): Encipher and encrypt are synonyms. Both words mean to convert the plaintext into cipher text. Key: The information, usually some sort of number, used with the algorithm to encrypt or decrypt the message. Think of the key as the fuel the algorithm requires in order to function. Key space: The total number of possible keys that could be used. For example, DES uses a 56-bit key; thus, the total number of possible keys, or the key space, is 256. Plaintext: The original message—the information you want to secure.
  • 8.
    Basic Terminologies Cryptanalysis: Cryptanalysis isthe study of analyzing and breaking cryptographic algorithms and systems to uncover hidden information or plaintext without knowledge of the cryptographic key. It involves various techniques, including frequency analysis, brute- force attacks, and mathematical analysis, to decipher encrypted messages. Cryptology: Cryptology is the broader field encompassing both cryptography and cryptanalysis. It deals with the study of techniques for secure communication and data protection, including the design, analysis, and implementation of cryptographic algorithms and protocols.
  • 9.
    Basic Terminologies Cryptogram: A cryptogramis a type of puzzle or game where a piece of text is encoded using a substitution cipher or other cryptographic technique, and the goal is to decipher the original message. Cryptosystem: A cryptosystem is a set of cryptographic algorithms and protocols used for encryption, decryption, and secure communication. It includes components such as encryption algorithms, cryptographic keys, key management systems, and communication protocols to ensure the confidentiality, integrity, and authenticity of data. Cryptocurrency: A cryptocurrency is a digital or virtual currency that uses cryptographic techniques to secure financial transactions, control the creation of new units, and verify the transfer of assets. Examples include Bitcoin, Ethereum, and Litecoin.
  • 10.
  • 11.
    History of Cryptography As civilizations evolved, human beings got organized in tribes, groups, and kingdoms.  This led to the emergence of ideas such as power, battles, supremacy, and politics.  These ideas further fueled the natural need of people to communicate secretly with selective recipient which in turn ensured the continuous evolution of cryptography as well.  The roots of cryptography are found in Roman and Egyptian civilizations  The first known evidence of cryptography can be traced to the use of ‘hieroglyph’.  Some 4000 years ago, the Egyptians used to communicate by messages written in hieroglyph
  • 12.
    Symmetric Cryptography: Insymmetric cryptography, the same key is used for both encryption and decryption. Examples include classical ciphers like the Caesar cipher and modern block ciphers like the Data Encryption Standard (DES). Asymmetric Cryptography: Asymmetric cryptography uses a pair of keys (public and private) for encryption and decryption. Examples include the Diffie-Hellman key exchange and public-key encryption algorithms like RSA. Types of Cryptography
  • 13.
  • 14.
    Transforming data intoan unreadable format using a specific algorithm and key. Process: Plaintext: Original, readable data. Encryption Algorithm: Mathematical formula that scrambles the data. Ciphertext: Encrypted, unreadable data. Key: Secret element used to control the encryption and decryption process. Encryption acts as a digital shield, transforming information into an unreadable form, rendering it unintelligible to anyone without the decryption key. This process involves applying an algorithm and a secret key to scramble the data, ensuring its confidentiality. Encryption
  • 15.
    Purpose of Encryption:Encryption ensures data confidentiality by protecting sensitive information from unauthorized access. It also helps maintain data integrity and authenticity during transmission and storage. . Encryption is the process of converting plaintext into ciphertext, making it unreadable to unauthorized users. It uses an algorithm and a key to scramble the data. Encryption
  • 16.
    Symmetric Encryption: Usesa single key for both encryption and decryption. Examples include Data Encryption Standard (DES) and Advanced Encryption Standard (AES). . Asymmetric Encryption: Uses a pair of keys (public and private) for encryption and decryption. Examples include Rivest-Shamir-Adleman (RSA) and Elliptic Curve Cryptography (ECC). Types of Encryption
  • 17.
  • 18.
    The process ofreversing encryption, transforming ciphertext back to its original plaintext form. Requires: Ciphertext: The encrypted data. Decryption Algorithm: The same algorithm used for encryption. Key: The same secret key used for encryption. Decryption is the counterpart of encryption, responsible for unlocking the scrambled data and retrieving the original message. It utilizes the same algorithm and decryption key employed during encryption, enabling authorized recipients to access the confidential information. Decryption
  • 19.
    Decryption is thereverse process of encryption, where ciphertext is converted back to plaintext using the appropriate decryption key. Secure management of decryption keys is crucial to prevent unauthorized access to encrypted data. The purpose of decryption is to allow authorized users or systems to access and interpret the encrypted data. Without decryption, the encrypted data remains unreadable and unusable to anyone who does not possess the appropriate decryption key or algorithm. Decryption
  • 20.
  • 21.
    Substitution Cipher A substitutioncipher substitutes one symbol with another. If the symbols in the plaintext are alphabetic characters, we replace one character with another. For example, we can replace character A with D, and character T with Z. If the symbols are digits (0 to 9), we can replace 3 with 7, and 2 with 6. Substitution ciphers can be categorized as either monoalphabetic or polyalphabetic ciphers.
  • 22.
    Monoalphabetic Cipher In amonoalphabetic cipher, a character (or a symbol) in the plaintext is always changed to the same character (or symbol) in the Ciphertext regardless of its position in the text. For example, if the algorithm says that character A in the plaintext is changed to character D, every character A is changed to character D. In other words, the relationship between characters in the plaintext and the Ciphertext is a one-to-one relationship. The following shows a plaintext and its corresponding ciphertext. Is the cipher monoalphabetic? Plaintext: HELLO Ciphertext: KHOOR
  • 23.
    Polyalphabetic Cipher In apolyalphabetic cipher, each occurrence of a character can have a different substitute. The relationship between a character in the plaintext to a character in the ciphertext is a one-to-many relationship. For example, character A could be changed to D in the beginning of the text, but it could be changed to N at the middle. It is obvious that if the relationship between plaintext characters and ciphertext characters is one-to many, the key must tell us which of the many possible characters can be chosen for encryption. To achieve this goal, we need to divide the text into groups of characters and use a set of keys. The following shows a plaintext and its corresponding ciphertext. Is the cipher mono alphabetic? Plaintext: HELLO Ciphertext: ABNZF
  • 24.
    Ceaser Cipher  TheCaesar cipher, also known as Caesar's shift or Caesar's code, is one of the earliest and simplest encryption techniques.  The Caesar Cipher works by shifting each letter in the plaintext message a certain number of positions down or up the alphabet.  For example, let's use a shift value of 3.  Replace each letter in the plaintext message with the letter that is three positions down the alphabet.  Wrap around to the beginning of the alphabet if necessary.  For example, using a Caesar Cipher with a shift value of 3:  Plaintext: "HELLO"  Encrypted: "KHOOR"
  • 25.
  • 26.
    Ceaser Cipher Practice Usinga shift cipher with a key of 3, encrypt the following : PT:"ENCRYPT THIS MESSAGE.”” CT:???? Using a shift cipher with a key of 2, Decrypt the following. CT: “JGNNQ YQTNF” PT: ???
  • 27.
    Mathematical Notation forCeaser Cipher For Encryption C = P + K = (mod 26) letter C to represent cipher text. letter P to represent plaintext letter K to represent the key. For Decryption P = C + K (mod 26)
  • 28.
    Atbash Cipher The AtbashCipher is a monoalphabetic substitution cipher that uses a simple algorithm where each letter in the plaintext is replaced with its corresponding letter from the reverse of the alphabet. It was used in ancient times and is one of the simplest types of substitution ciphers. How the Atbash Cipher Works  Take the alphabet (A-Z for English) and reverse it:  Normal Alphabet: 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  Reverse Alphabet: Z Y X W V U T S R Q P O N M L K J I H G F E D C B A  Substitute each letter in the plaintext with its counterpart in the reversed alphabet:  A becomes Z, B becomes Y, C becomes X and so on.  Non-alphabetic characters such as numbers, punctuation, and spaces are usually left unchanged. Encryption: Plain text: DESIGN Cipher text: WVHRTM Decryption: Cipher Text: ZGYZHS Plain Text: ???? For Practice Plain Text: Cryptography is Fun! Cipher Text: ???
  • 29.
    Affine Cipher The AffineCipher is a type of monoalphabetic substitution cipher that combines both multiplication and addition to encode letters. It is more complex than the Atbash cipher and uses a mathematical formula to perform encryption and decryption. How the Affine Cipher Works The encryption and decryption are based on the following formulae: Encryption Formula: E(x) = ax + b (mod m) x: Position of the plaintext letter in the alphabet (starting from 0 for A, 1 for B, ..25 for Z). a: Multiplicative key (must be coprime with m, i.e., gcd(a, m) = 1). b: Additive key. m: Size of the alphabet (26 for English). E(x): Position of the cipher text letter. Decryption Formula: D(y)=a-¹ (y b)mod m ⋅ − y: Position of the ciphertext letter. a¹: Modular multiplicative inverse of a(i.e., a a 1mod m=1 ⋅ − Key Requirements The key pair is (a,b)(a, b)(a,b), where: a must be coprime with m. b is any integer between 0 and m 1. (0 to 25) −
  • 30.
    Affine Cipher Steps toEncrypt and Decrypt Convert each letter in the plaintext to its numerical equivalent (A=0, B=1, ..., Z=25). Apply the encryption formula to find the cipher text letter. For decryption, apply the decryption formula to revert to the plaintext letter. Map the numerical results back to their corresponding letters. Example 1: Encryption Plaintext: HELLO Key: a=5, b=8. Encryption Formula: E(x)=(ax+b)mod 26 Convert letters to numbers: H 7, E 4, L 11, L 11, O 14. → → → → → Apply E(x) to each letter: H (7): (5 7+8)mod 26=43mod 26=17 R ⋅ → E (4): (5 4+8)mod 26=28mod 26=2 C ⋅ → L (11): (5 11+8)mod 26=63mod 26=11 L ⋅ → L (11): (5 11+8)mod 26=63mod 26=11 L ⋅ → O (14): (5 14+8)mod 26=78mod 26= 0 A ⋅ → Cipher text: RCLLA Decryption: ???
  • 31.
    Rot 13 The ROT13(Rotate by 13) cipher is a simple substitution cipher where each letter of the alphabet is shifted 13 places forward in the alphabet. It is a special case of the Caesar cipher with a fixed shift of 13 characters. Each letter in the alphabet has a numeric position. A = Position 1, B = Position 2, C = Position 3 and so on Z = Position 26. Because the English alphabet contains 26 letters, ROT13 is its own inverse—applying the ROT13 transformation twice restores the original text.
  • 32.
    Rot 13 Formula forROT13 Encryption and Decryption For a given letter x: X denotes P.T, Y denotes C.T. Encryption: E = (P + 13) mod 26 Decryption: D = (C 13) mod 26 − Encryption Plain Text: Power Cipher Text: ?? Decryption Cipher Text: MNGBBA Plain Text: ???
  • 33.
    Vigenère Cipher Vigenère Cipher TheVigenère Cipher is a type of multi-alphabet substitution cipher that encrypts text by using a series of different Caesar ciphers based on a keyword. It was invented by Giovan Battista Bellaso in 1553 and is named after Blaise de Vigenère. The Vigenère Cipher was historically considered unbreakable due to its use of multiple shifting alphabets, and it remained widely used until the 19th century. How It Works The cipher uses: Plaintext: The original message to encrypt. Key: A repeated sequence of letters or a keyword to determine the shifting of the alphabets. Vigenère Table (or Square): A 26x26 grid of alphabets, where each row represents a Caesar cipher shifted by one position. (A=0, B=1,,,, Z=25)  Encryption  P+K mod 26  Decryption  C-K mod 26
  • 34.
  • 35.
    Polybius Square The Polybiuscipher is a 2-dimensional substitution cipher that maps each letter to a pair of numbers based on its position in a 5×5 grid (a table of the alphabet). It is a classical cipher that was used in ancient times, particularly by the Greeks. The Polybius square only contains the 25 letters of the alphabet, where 'I' and 'J' are often combined to form a single cell in the grid. Polybius Square Setup Step 1: Create the 5×5 Grid • Each row and column is numbered from 1 to 5. • For example: • The letter A is in position (1,1). • The letter E is in position (1,5). • The letter J is usually combined with I and placed in the same cell. Each letter corresponds to its row and column number. For example: A → (1,1) Code → 11 E → (1,5) Code → 15
  • 36.
    Polybius Square Encrypting theWord "HELLO" Let's encrypt the word "HELLO" using the Polybius cipher. Step 1: Locate the letters in the 5×5 grid Step 2: Replace each letter with its code The word "HELLO" becomes "23 15 31 31 34". Decrypting the Code "23 15 31 31 34" Let's decrypt the code "23 15 31 31 34" by converting each pair back to its letter: So, "23 15 31 31 34" decrypts to "HELLO". For Practice: Encryption Plain Text: JUMP Code:??? Decryption Code: 42 15 24 32 15. Plain text: ???
  • 37.
    Multi-Alphabet Substitution Cipher Multi-AlphabetSubstitution Cipher The Multi-Alphabet Substitution Cipher is an encryption method that uses multiple substitution alphabets to encode a message. Unlike a simple substitution cipher (where each letter is replaced by one fixed substitute), multi-alphabet substitution ciphers vary the substitution throughout the text, making them more resistant to frequency analysis attacks. One of the most famous examples of a multi-alphabet cipher is the Vigenère Cipher. How It Works In multi-alphabet substitution: Multiple Alphabets: Use several substitution alphabets instead of just one. For example, you could shift letters by 3 in one alphabet, 5 in the next, and so on. Key: A key determines which substitution alphabet to use for each letter in the plaintext. Pattern: The pattern of substitution repeats based on the length of the key.
  • 38.
    Play fair cipher ThePlay fair Cipher is a manual symmetric encryption technique that operates on pairs of letters rather than individual characters. It was invented in 1854 by Charles Wheatstone but was named after Lord Play fair, who promoted its use. Key Components: Key Square: A 5x5 grid filled with the letters of the alphabet (often with 'I' and 'J' combined). The key or keyword is placed in the grid first, followed by the remaining letters in alphabetical order. Digraphs: The plaintext message is divided into pairs of letters (digraphs). If a pair consists of repeated letters, a filler letter like 'X' is added between them. If the message has an odd number of letters, a filler letter is added at the end. Encryption Rules: Same Row: If both letters of a digraph are in the same row of the key square, replace each letter with the letter to its immediate right. The rightmost letter wraps around to the leftmost position. Same Column: If both letters of a digraph are in the same column, replace each letter with the letter immediately below it. The bottommost letter wraps around to the topmost position. Different Row and Column: If the letters are in different rows and columns, form a rectangle with the two letters. Replace each letter with the letter at the opposite corner of the rectangle.
  • 39.
    Playfair Cipher Plain Text:Attack at dawn Keyword: Falcon Cipher Text: ??? Use Book(Modern Cryptography) to see the solution For Practice Key: PLAYFAIREXAMPLE Plaintext: "HIDE THE GOLD IN THE TREE STUMP" Prepare the plaintext: "HIDEXTHEGOLDINTHEXTREESTUMP" Create the key square:
  • 40.
    Hill Cipher The HillCipher is a polygraphic substitution cipher based on linear algebra. It was invented by Lester S. Hill in 1929 and is one of the earliest ciphers to use mathematical operations for encryption and decryption. Key Concepts of Hill Cipher: Matrix-Based Encryption: The Hill Cipher uses a matrix of size n × n as the encryption key. Both the plaintext (in blocks of size n) and the key are represented as matrices over a finite field (typically modulo 26 for the English alphabet). Encryption Process: Convert plaintext into numerical form (A = 0, B = 1, ..., Z = 25). Break the plaintext into blocks of size n. Multiply each plaintext block (vector) by the key matrix. Compute the modulo operation to ensure the result is within the valid range of alphabetic characters. Convert the resulting numerical values back to letters. Formula for Encryption: C=(K P)mod 26 ⋅
  • 41.
    Hill Cipher Example: 1. KeyMatrix (2×2): 2. K=[] 3. Plaintext (2-letter blocks): "HI“ (78) Numerical equivalent: P=[ 4. Encrypt: C=(K P)mod 26 ⋅ C= [ [ 26 ⋅ C= mod 26 C=[ C=
  • 42.
    Transposition Techniques Transposition techniqueis an encryption method which is achieved by performing permutation over the plain text. Mapping plain text into cipher text using transposition technique is called transposition cipher. Reverse Order Rail Fence Transposition Columnar Transposition Running Key Cipher One Time Pad
  • 43.
    Reverse Order The ReverseOrder Cipher Technique is a simple and basic transposition cipher where the plaintext is encrypted by reversing the order of its characters. This technique does not substitute characters but instead rearranges their positions. It is one of the easiest forms of encryption. Steps for Reverse Order Cipher: Write the Plaintext: Start with a plaintext message. Example: SECRET MESSAGE Reverse the Order: Write the characters in reverse order to form the ciphertext. Cipher text: EGASSEMTERCES Decryption: The decryption process is the same—reverse the order of the ciphertext to retrieve the plaintext. Example: Plaintext: KEEP IT SIMPLE Cipher text: ELPMISTIPEEK
  • 44.
    Rail Fence Cipher Therail fence cipher is the simplest transposition cipher. The steps to obtain cipher text using this technique are as follow: Step 1: The plain text is written as a sequence of diagonals. Step 2: Then, to obtain the cipher text the text is read as a sequence of rows. Plain Text: meet me Tomorrow Cipher Text: M E M T M R O E T E O O R W
  • 45.
    Columnar Transposition Technique AColumnar Cipher is a transposition cipher that rearranges the characters of plaintext based on a predefined key, which determines the order of the columns. The cipher text is created by writing the plaintext in rows under the key and then reading the columns in the order specified by the key. Steps in Columnar Cipher: Choose a Key: The key is a word or sequence that determines the columnar arrangement. Each letter in the key is assigned a number based on its alphabetical order. For example, key ‘DESIGN’ D(1) E(2) S(6) I(4) G(3) N(5) Write Plaintext in Rows: Write the plaintext beneath the key in rows of equal length (pad with filler characters if necessary). Example: Plaintext: Secure Your Data Now Key: DESIGN (1 2 6 4 3 5 ) Arranged as: S E C U R E Y O U R D A T A N O W X (Note: "X" is used as a padding character to fill the table). Read Columns in Key Order: Read the columns based on the numerical order of the key letters. Using the above key D(1) E(2) S(6) I(4) G(3) N(5) Column order: 1 2 6 4 3 5 → → → → → Cipher text: SYT EOA EAX URO CUN RDW
  • 46.
    One Time Pad TheOne-Time Pad (OTP) Cipher is an encryption technique that is theoretically unbreakable when implemented correctly. The OTP Cipher also called the Vernam Cipher It uses a random, one-time-use key that is as long as the plaintext message. The key is combined with the plaintext to produce the cipher text. Key Generation: The key must be completely random, truly unpredictable, and at least as long as the plaintext. The key is used only once, hence the name "One-Time Pad." Encryption: Each character of the plaintext is combined with the corresponding character of the key using modular arithmetic. For letters, modular arithmetic is used: Cipher text Character= (Plaintext Character + Key Character) mod 26 Decryption: The cipher text is combined with the same key to retrieve the plaintext. For letters: Plaintext Character=(Cipher text Character Key Character)mod 26 −
  • 47.
    One Time Pad ForAlphabetic Data: Plaintext: HELLO Key: XMCKL (random key of the same length) Convert letters to numbers: A=0,B=1,…,Z=25 Plaintext: H=7,E=4,L=11,L=11,O=14 Key: X=23,M=12,C=2,K=10,L=11 Encryption: Cipher text=(Plain text+ Key)mod 26 7+23=30mod 26=4(E) , 4+12=16(Q) , 11+2=13(N) , 11+10=21(V) ,14+11=25(Z) Cipher text: EQNVZ For Practice P.T: PERFECT Key(OTP): WHITE (if key length is short then repeat the same key until the plaintext space is filled. Cipher text:???
  • 48.
    Running Key Cipher TheRunning Key Cipher, also known as the Autokey Cipher or Book Cipher, is a variation of the Vigenère Cipher. It uses a long, predetermined text (such as a book, poem, or passage) as the encryption key. The plaintext and key text are combined in a character-by-character fashion to produce the cipher text. Key Selection: A long text, often publicly available, is chosen as the key. Both the sender and receiver agree on this key text and know the exact starting point within it. Encryption: Each character of the plaintext is paired with a corresponding character from the key text. The two characters are then combined using modular arithmetic (often modulo 26 for English alphabets). For example: Cipher text Character=(Plaintext Character + Key Character)mod 26 Decryption: The receiver retrieves the key text and uses it to reverse the encryption process. The cipher text is paired with the same key text to recover the plaintext: Plaintext Character=(Cipher text Character Key Character)mod 26 −
  • 49.
    Running Key Cipher Howit works: Step 1: Convert the plain text in numeric form consider A=0, B=1, C=3 …, Z=25. Step 2: Take an onetime pad or key from any of the books and convert it in the numeric form also. But the key must be as long as the length of plain text. Step 3: Now add the numeric form of both plain text and key, each plain text letter with corresponding key text letter. If the addition of any plain text letter with corresponding key text letter is >26, then subtract it with 26. Plaintext: HELLO Key Text: A long text starting with "WORLD" Convert letters to numbers: A=0,B=1,…,Z=25 Plaintext: H=7, E=4, L=11, L=11, O=14 Key: W=22, O=14, R=17, L=11, D=3 Cipher text=(Plaintext+ Key)mod 26 7+22=29mod 26=3(D) 4+14=18(S) 11+17=28mod 26=2(C) 11+11=22(W) 14+3=17(R) Cipher text: DSCWR
  • 50.
    Symmetric Key Cryptography SymmetricalKey Cryptography also known as conventional or single-key encryption was the primary method of encryption before the introduction of public key cryptography in the 1970s. In symmetric-key algorithms, the same keys are used for data encryption and decryption. This type of cryptography plays a crucial role in securing data because the same key is used for both encryption and decryption.
  • 51.
    Techniques Used inSymmetric Key Cryptography Substitution and Transposition are two principal techniques used in symmetric-key cryptography. Substitution Techniques The symmetric key cryptographic method employs one secret key for the operations of encryption and decryption. Substitution techniques provide two significant approaches, wherein elements (letters, characters) from the plaintext message are replaced with new elements according to the rules based on the secret key. For Example Ceaser Cipher, Hill Cipher, Play Fair Cipher, Monoalphabetic Cipher, Polyalphabetic Cipher, Vigenere Cipher. Transposition Techniques Transposition techniques rearrange the order of elements in the plaintext message without changing the elements themselves. Reverse Order, Rail Fence Cipher, Columnar Cipher, Book Cipher, Vernam Cipher.
  • 52.
    Types of SymmetricKey Cryptography There are two types of Symmetric Key Cryptography. Stream Cipher The encryption process begins with the stream Cipher algorithm generating a pseudo- random keystream made up of the encryption key and the unique randomly generated number known as the nonce. The result is a random stream of bits corresponding to the length of the ordinary plaintext. Then, the ordinary plaintext is also deciphered into single bits. These bits are then joined one by one to the keystream bits, gradually converting the ordinary plaintext into the cipher text using the XOR bitwise operations. The most common stream cipher algorithms are RC4, Salsa-20, Grain-128 etc. Block Cipher The result of a block cipher is a sequence of blocks that are then encrypted with the key. The output is a sequence of blocks of encrypted data in a specific order. When the cipher text travels to its endpoint, the receiver uses the same cryptographic key to decrypt the cipher text block chain to the plaintext message. The most common stream cipher algorithms are DES, AES etc.
  • 53.
    Block Cipher A BlockCipher is a method of encrypting data in fixed-size blocks, typically of 64 or 128 bits. In this process, plaintext data is divided into equal-sized blocks, and each block is independently encrypted into cipher text using a specific algorithm and a secret key. If the plaintext data is not a multiple of the block size, padding is added to the last block to make it the correct size. Key Features: Fixed Block Size: Operates on a fixed number of bits per block. Symmetric Key Algorithm: Uses the same key for both encryption and decryption. Deterministic Nature: For the same input block and key, it produces the same output block. Examples of Block Ciphers: DES (Data Encryption Standard): Uses 64-bit blocks with a 56-bit key. AES (Advanced Encryption Standard): Supports 128, 192, or 256-bit keys with 128-bit blocks. Blowfish: Uses variable-length keys (up to 448 bits) and 64-bit blocks.
  • 54.
  • 55.
    Feistel Cipher The Feistelcipher is a symmetric structure used in the design of block ciphers, named after Horst Feistel, who developed it while working at IBM in the early 1970s. The structure is widely used in cryptographic algorithms like DES (Data Encryption Standard), Blowfish, and Twofish. Key Features of a Feistel Cipher: Block Cipher: Operates on fixed-size blocks of data, such as 64-bit or 128-bit blocks. Divides each block into two equal halves (left and right). Iterative Rounds: Data is processed through multiple rounds (e.g., 16 rounds in DES). Each round uses a subkey derived from the main key. Structure: Each block is split into two halves: L0L_0L0​(Left) and R0R_0R0​(Right). In each round: Li+1= Ri Ri+1=Li F (Ri,Ki) · · F is a round function (e.g., substitution, permutation, or other complex operations). Ki​is the round-specific subkey. ⊕ represents the XOR operation.
  • 56.
  • 57.
  • 58.
    The art andscience of hiding information within a cover medium, such as an image, audio, or video file. Goal: Conceal the existence of the hidden message. Steganography takes a different approach to information security. Unlike encryption, which scrambles data, steganography aims to hide the message itself within another seemingly harmless carrier file. This technique conceals the very existence of the hidden information, making it even more challenging to detect. Steganography
  • 59.
  • 60.
  • 61.
    DES Data Encryption Standard(DES) The Data Encryption Standard (DES) is a symmetric key block cipher widely used for encryption. It was developed in the 1970s and standardized by NIST (National Institute of Standards and Technology). DES encrypts data in blocks of 64 bits using a 56-bit key. Features:  Encryption/Decryption Algorithm (P.T C.T)  DES is a block Cipher  Input and Output Size is 64 bit.  16 rounds  Initial Key size is 64 bit but after discard the initial permutation we remove the 8 bits by the 8th bit. Like 8×1= 8, 8×2= 16, 8×3= 24, 8×4= 32, 8×5= 40, 8×6= 48, 8×7= 56, 8×8= 64.  After Removing 8 bits key size is 56.  Now divide the 56 bits into two equal halves 28+28 =56.  Left Circular Shift depend on the round number if the round is 1, 2, 9 and 16 then we shift the 1(one) bit.  Every round the 48 bit key is different.
  • 62.
  • 63.
    2 DES Two DataEncryption Standard (2DES) 2DES Algorithm (Double DES) is an extension of the original DES algorithm that was designed to improve its security. It applies the DES algorithm twice using two different keys to mitigate brute-force attacks. Key Features: Input: Two different 56-bit keys (Key1 and Key2) are used. Double Encryption: Plaintext is encrypted twice using DES. Output: The resulting cipher text has an increased level of security (compared to single DES)
  • 64.
    3 DES Triple DataEncryption Standard (3DES) Triple DES (3DES) is an improved version of the original DES algorithm that applies the encryption process three times using either two or three different keys. It was designed to address the security weaknesses of single DES, especially against brute-force attacks. Key Features Multiple Keys: Option 1: Two keys (Key1 and Key2) are used. Option 2: Three keys (Key1, Key2, and Key3) are used for stronger security. Triple Encryption: Data is encrypted, decrypted, and then encrypted again. Increased Key Size: Using three 56-bit keys makes the effective key size 168 bits (or 112 bits in the case of two keys).
  • 65.
  • 66.
    AES  Advanced EncryptionStandard (AES) is an encryption standard adopted by the U.S. government.  Most Strongest Algorithm ever symmetric key block cipher. Same key is used for encryption and decryption.  The AES Encryption algorithm (also known as the Rijndael algorithm)  The standard comprises three block ciphers, AES-128, AES-192 and AES-256, adopted from a larger collection originally published as Rijndael.  Each AES cipher has a 128-bit block size, with key sizes of 128, 192 and 256 bits, respectively. The Structure is based on the Substitution-permutation network.  The AES ciphers have been analyzed extensively and are now used worldwide, as was the case with its predecessor, the Data Encryption Standard (DES).
  • 67.
    AES Advanced Encryption Standard(AES) is an encryption standard adopted by the U.S. government. Most Strongest Algorithm ever symmetric key block cipher. Same key is used for encryption and decryption. The AES Encryption algorithm (also known as the Rijndael algorithm) Key Sizes: Supports 128-bit, 192-bit, and 256-bit keys. · Block Size: Operates on fixed 128-bit blocks of data. · Symmetric Encryption: Uses the same key for both encryption and decryption. · Rounds: 10 rounds for 128-bit keys. 12 rounds for 192-bit keys. 14 rounds for 256-bit keys.  The Structure is based on the Substitution-permutation network.  The AES ciphers have been analyzed extensively and are now used worldwide, as was the case with its predecessor, the Data Encryption Standard (DES).
  • 68.
  • 69.
    Public Key Cryptography Unlike symmetric key cryptography, we do not find historical use of public-key cryptography.  It is a relatively new concept.  Symmetric cryptography was well suited for organizations such as governments, military, and big financial corporations were involved in the classified communication.  With the spread of more unsecure computer networks in last few decades, a genuine need was felt to use cryptography at larger scale.  The symmetric key was found to be non-practical due to challenges it faced for key management.  This gave rise to the public key cryptosystems.
  • 70.
    Public Key Cryptography Mechanismof public key cryptography.
  • 71.
    Public Key Cryptography The most important properties of public key encryption scheme are −  Different keys are used for encryption and decryption. This is a property which set this scheme different than symmetric encryption scheme.  Each receiver possesses a unique decryption key, generally referred to as his private key.  Receiver needs to publish an encryption key, referred to as his public key.  Some assurance of the authenticity of a public key is needed in this scheme to avoid spoofing by adversary as the receiver. Generally, this type of cryptosystem involves trusted third party which certifies that a particular public key belongs to a specific person or entity only.
  • 72.
  • 73.
    RSA  The systemwas invented by three scholars Ron Rivest, Adi Shamir, and Len Adleman  Hence, it is termed as RSA cryptosystem.  Public, Private Key Encryption and Decryption
  • 74.
    Generation of KeyPair Each person or a party who desires to participate in communication using encryption needs to generate a pair of keys, namely public key and private key. The process followed in the generation of keys is described below − Generate the RSA modulus (n) Select two large primes, p and q. Calculate n=p*q. For strong unbreakable encryption, let n be a large number, typically a minimum of 512 bits. Find Derived Number (e) Number e must be greater than 1 and less than (p 1)(q 1). − − There must be no common factor for e and (p 1)(q 1) except for 1. In other words − − two numbers e and (p – 1)(q – 1) are coprime
  • 75.
    Generation of KeyPair Form the public key  The pair of numbers (n, e) form the RSA public key and is made public.  Interestingly, though n is part of the public key, difficulty in factorizing a large prime number ensures that attacker cannot find in finite time the two primes (p & q) used to obtain n. This is strength of RSA.  Generate the private key  Private Key d is calculated from p, q, and e. For given n and e, there is unique number d.  Number d is the inverse of e modulo (p - 1)(q – 1). This means that d is the number less than (p - 1)(q - 1) such that when multiplied by e, it is equal to 1 modulo (p - 1)(q - 1).  This relationship is written mathematically as follows −  ed = 1 mod (p 1)(q 1) − −
  • 76.
  • 77.
  • 78.
  • 79.

Editor's Notes

  • #6  Cryptography is the study of how to alter a message so that someone intercepting it cannot read it without the appropriate algorithm and key.
  • #11 Hieroglyphs are a system of writing that uses pictures or symbols to represent objects, concepts, or sounds. The term "hieroglyph" comes from the Greek words "hieros," meaning sacred or holy, and "glyph," meaning carving or engraving. Hieroglyphs were primarily used in ancient Egypt as a formal writing system, but similar systems have been used in other cultures around the world.
  • #15 Applications of Encryption Secure communication: Emails, instant messaging, online transactions. Data storage: Protecting sensitive information on hard drives and cloud storage. Financial transactions: Securing online banking and payment systems. E-commerce: Safeguarding customer data during online purchases.
  • #16 In general, the term "symmetric" refers to a situation where two or more parts or components are identical, similar, or equal in size, shape, or characteristics relative to a central point, axis, or line. In various contexts, including mathematics, science, technology, and communication, the term "symmetric" may have specific meanings: Symmetric in Technology and Communication: In computer science and networking, symmetric can refer to symmetric encryption algorithms, where the same key is used for both encryption and decryption. In contrast to "symmetric," the term "asymmetric" refers to a situation where two or more parts or components are not identical, equal, or balanced in size, shape, or characteristics relative to a central point, axis, or line. In various contexts, including mathematics, science, technology, and communication, the term "asymmetric" may have specific meanings: Asymmetric in Technology and Communication: In computer science and cryptography, asymmetric encryption algorithms use different keys for encryption and decryption, providing enhanced security compared to symmetric encryption. In telecommunications, asymmetric digital subscriber line (ADSL) is a type of DSL technology that provides higher bandwidth for downstream data transmission than for upstream data transmission.
  • #21 Substitution refers to replacing one thing with another, typically of the same kind or function.
  • #22 The cipher is probably monoalphabetic because both occurrences of L's are encrypted as O's.
  • #23 Solution The cipher is not monoalphabetic because each occurrence of L is encrypted by a different character. The first L is encrypted as N; the second as Z.
  • #24 The Caesar Cipher, also known as the shift cipher, is one of the simplest and oldest encryption techniques in cryptography. It is named after Julius Caesar, who is said to have used it to communicate secretly with his generals during military campaigns. The Caesar Cipher works by shifting each letter in the plaintext message a certain number of positions down or up the alphabet. For example, if the shift value (also known as the key) is 3, then each letter in the plaintext will be replaced by the letter three positions down the alphabet.
  • #26 1. PT:"ENCRYPT THIS MESSAGE.”” CT:???? Answer: 2. CT: “JGNNU YQTNQ” PT: ??? Answer: HELLO WORLD
  • #27 1. PT:"ENCRYPT THIS MESSAGE.”” CT:???? Answer: 2. CT: “JGNNU YQTNQ” PT: ??? Answer: HELLO WORLD
  • #28 Decryption: Cipher Text: ZGZRM Plain Text: Attain Plain Text: Cryptography is Fun! Cipher Text: XIBKGLTIZKSB RH UF.
  • #30 the key pairs a and b given in question ? Yes, in questions involving the Affine Cipher, the key pair (a,b)(a, b)(a,b) is typically provided, as they are crucial for encryption and decryption. These keys define how the cipher operates: a: The multiplicative key, which determines the multiplication applied to each letter's numerical position. a must be coprime with m (the size of the alphabet, typically m=26 for English). Coprime with m: gcd(a,26)=1. Some valid values of a for m=26 are: 1,3,5,7,9,11,15,17,19,21,23,25 b: The additive key, which determines the addition after the multiplication step. b can be any integer in the range 0≤b<m. e.g (0 to 25) These two values together (a,b) are the keys for the Affine Cipher.
  • #31  Hint: During decryption, if you encounter negative values, simply add 26.
  • #32 Hint: During decryption, if you encounter negative values, simply add 26.
  • #33 Basic Encryption Plaintext: "ATTACKATDAWN" Keyword: "LEMON" Encrypt the message. 2. Basic Decryption Ciphertext: "LXFRQRBKDQ" Keyword: "SECRET" Decrypt the message. 3. Longer Message Plaintext: "THEQUICKBROWNFOXJUMPSOVERTHELAZYDOG" Keyword: "CRYPTOGRAPHY" Encrypt the message. 4. Finding the Keyword (Easy) Ciphertext: "VCHIQW" Plaintext: "SECRET" Find the keyword. 5. Finding the Keyword (Moderate) Ciphertext: "WKHSDQHO" Plaintext: "HELLO" Find the keyword.
  • #34 Plain Text: YES Key: WAY Cipher Text: U Ciphertext: HGTSQH PlainText: Dreams Keys: DooR Hint: During decryption, if you encounter negative values, simply add 26.
  • #35 Grid Structure:The alphabet is arranged in a 5×5 grid. The letter 'I' and 'J' are combined into a single cell. Numbers Represent Pairs:Each letter is represented by a pair of numbers corresponding to its row and column in the grid. Spaces Are Ignored:In traditional implementations of the Polybius cipher, spaces and punctuation marks are often omitted.
  • #38  Playfair Cipher The Playfair Cipher is a digraph substitution cipher that encrypts pairs of letters (digraphs) instead of single letters. It was invented by Charles Wheatstone in 1854 and popularized by Lord Playfair. This cipher was used for tactical communications by British forces in World War I and II. How It Works Key Elements Plaintext: The message to encrypt. Key: A word or phrase used to construct a 5x5 matrix of letters. The alphabet is written into the matrix using the key first, followed by the remaining letters of the alphabet. The letters I and J are typically combined to fit into the 25 spaces. Steps for Encryption Create a 5x5 Matrix: Use the key to fill the matrix, omitting duplicate letters. Add the remaining letters of the alphabet. Divide the Plaintext into Digraphs: Split the plaintext into pairs of letters. If a pair has two identical letters, insert a filler (e.g., 'X') between them. Example: BALLOON → BA LX LO ON If the plaintext length is odd, add a filler at the end. Encrypt Each Digraph: Find the two letters of the digraph in the matrix. Apply the following rules: Same Row: Replace each letter with the letter to its immediate right (wrap around to the start if necessary). Same Column: Replace each letter with the letter immediately below it (wrap around to the top if necessary). Rectangle Rule: If the letters form a rectangle, replace each letter with the one in its row but in the column of the other letter. Combine the Encrypted Digraphs: Write the resulting ciphertext. Steps for Decryption Use the same matrix as for encryption. Reverse the encryption rules: Same Row: Replace each letter with the one to its immediate left. Same Column: Replace each letter with the one immediately above. Rectangle Rule: Swap letters using the rectangle rule.
  • #39 In the Playfair Cipher, when the keyword contains both "I" and "J," they are typically treated as the same letter and occupy a single position in the 5x5 key square. Here's how it works: Combine "I" and "J": Before constructing the key square, treat "I" and "J" as a single letter. If either appears in the keyword, only include one of them. Construct the Key Square: Fill the key square with the letters of the keyword (without duplicates). Fill the remaining spaces with the remaining letters of the alphabet in alphabetical order (omitting the duplicate "I" or "J"). Encryption/Decryption: During encryption and decryption, if you encounter a "J" in the plaintext or ciphertext, treat it as an "I." Example: Keyword: "PLAYFAIR" Key Square: P L A Y F I R E X M B C D G H K N O Q S T U V W Z
  • #42 In the context of cryptography, transposition refers to a technique where the positions of characters in the plaintext are rearranged according to a certain rule or pattern to create the ciphertext. Unlike substitution, where individual characters are replaced with other characters, transposition retains the original characters but alters their order.
  • #43 In the context of cryptography, transposition refers to a technique where the positions of characters in the plaintext are rearranged according to a certain rule or pattern to create the ciphertext. Unlike substitution, where individual characters are replaced with other characters, transposition retains the original characters but alters their order.
  • #45 For example, for the key SECRET, the sequence is S(4) E(2) C(1) R(3) E(2) T(5). Write Plaintext in Rows: Write the plaintext beneath the key in rows of equal length (pad with filler characters if necessary). Example: Plaintext: HELLO WORLD Key: SECRET Arranged as: mathematica Copy code S E C R E T H E L L O W O R L D X X (Note: "X" is used as a padding character to fill the table). Read Columns in Key Order: Read the columns based on the numerical order of the key letters. Using the above key (C(1) E(2) E(2) R(3) S(4) T(5)): Column order: 3 → 2 → 2 → 4 → 1 → 5 Ciphertext: LLH ORO ELW DX
  • #49 PT: Meet Tomorrow Key: ANENCRYPTION CT: MRIGVFKDKZCJ.
  • #50 PT: Meet Tomorrow Key: ANENCRYPTION CT: MRIGVFKDKZCJ.
  • #53 Common Block Cipher Modes: To enhance security and handle varying lengths of plaintext, block ciphers are often used in different modes of operation, such as: ECB (Electronic Codebook): Encrypts each block independently; less secure due to patterns in the plaintext being reflected in the ciphertext. CBC (Cipher Block Chaining): Links blocks by XORing each plaintext block with the previous ciphertext block before encryption. CFB (Cipher Feedback): Converts a block cipher into a stream cipher, encrypting smaller units of plaintext. OFB (Output Feedback): Also converts a block cipher into a stream cipher but avoids error propagation. CTR (Counter Mode): Encrypts data blocks in parallel, improving performance.
  • #54 Step-by-Step Working of Block Cipher in CBC Mode Input Preparation: Plaintext Division: The plaintext is divided into fixed-size blocks (e.g., 64-bit or 128-bit). Padding is added to the last block if it's smaller than the block size. Key Setup: A symmetric key is generated or provided. This key will be used for both encryption and decryption. Initialization Vector (IV): A random block of data is generated. This ensures that even if the same plaintext is encrypted multiple times with the same key, the ciphertext will be different each time. The IV is XORed with the first plaintext block before encryption. This step is crucial for adding randomness to the encryption process. Encryption Process: Step 1: Substitution (S-Box) The plaintext block (or intermediate data) undergoes substitution using a predefined Substitution Box (S-Box). The S-Box replaces portions of the data with other values to introduce non-linearity and complexity. Step 2: Permutation (P-Box) The substituted data is then permuted using a Permutation Box (P-Box). The P-Box shuffles the bits to ensure diffusion, spreading the plaintext information across the entire block. Step 3: Key Mixing The permuted data is combined with the key using XOR operations. This step ensures that the encryption depends on the secret key. Chaining Mechanism: First Block: The first plaintext block is XORed with the IV. The result is then encrypted using the block cipher (S-Box, P-Box, Key Mixing). The output is the first ciphertext block. Subsequent Blocks: Each subsequent plaintext block is XORed with the previous ciphertext block before encryption. This chaining mechanism ensures that each block's encryption depends on the previous block's ciphertext, enhancing security. Iteration (Rounds): The process of substitution, permutation, and key mixing is repeated multiple times (e.g., 10, 12, or 14 rounds in AES) with each round using a different round key derived from the original key. This increases security by making the ciphertext more resistant to attacks. Relationship Between S-Box, P-Box, and IV: S-Box and P-Box: These are fundamental components used in the block cipher's internal transformations. The S-Box provides non-linearity by substituting parts of the data, while the P-Box ensures diffusion by shuffling the bits. IV: The IV is used only for the first block and ensures that even if the same plaintext is encrypted multiple times with the same key, the ciphertext will be different each time. It adds an extra layer of security by introducing randomness.
  • #55 PT: Meet Tomorrow Key: ANENCRYPTION CT: MRIGVFKDKZCJ.
  • #56 F stands for Function in which F =(K,R) K stands key and R stands for Right half of PlainText.
  • #74 In the RSA algorithm, n is the product of two large prime numbers p and q: n=p×q Role of n: Part of the Public and Private Keys: Both the public key (e,n) and the private key (d,n) include n. It serves as the modulus in the encryption and decryption operations.
  • #78 Trust is a very complex topic; in reality, we cannot function without trust. If one were to think that the laptop vendor has installed spyware on the laptop, they would most likely end up rebuilding the system. If one were to mistrust the hardware vendor, they would stop using it completely. If we think of trust on a business level, things only become more sophisticated; however, we need some guiding security principles. Two security principles that are of interest to us regarding trust: Trust but Verify Zero Trust Trust but Verify: This principle teaches that we should always verify even when we trust an entity and its behaviour. An entity might be a user or a system. Verifying usually requires setting up proper logging mechanisms; verifying indicates going through the logs to ensure everything is normal. In reality, it is not feasible to verify everything; just think of the work it takes to review all the actions taken by a single entity, such as Internet pages browsed by a single user. This requires automated security mechanisms, such as proxy, intrusion detection, and intrusion prevention systems. Zero Trust: This principle treats trust as a vulnerability, and consequently, it caters to insider-related threats. After considering trust as a vulnerability, zero trust tries to eliminate it. It is teaching indirectly, “never trust, always verify.” In other words, every entity is considered adversarial until proven otherwise. Zero trust does not grant trust to a device based on its location or ownership. This approach contrasts with older models that would trust internal networks or enterprise-owned devices. Authentication and authorization are required before accessing any resource. As a result, if any breach occurs, the damage would be more contained if a zero trust architecture had been implemented. Microsegmentation is one of the implementations used for Zero Trust. It refers to the design where a network segment can be as small as a single host. Moreover, communication between segments requires authentication, access control list checks, and other security requirements. There is a limit to how much we can apply zero trust without negatively impacting a business; however, this does not mean that we should not apply it as long as it is feasible.