0% found this document useful (0 votes)
42 views108 pages

Data Security & Privacy Course Materials

Module 1

Uploaded by

4mt22ai029
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views108 pages

Data Security & Privacy Course Materials

Module 1

Uploaded by

4mt22ai029
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

DEPARTMENT OF ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING

Course Materials
for

Subject Title : DATA SECURITY & PRIVACY


Subject Code :BAD703
Semester :7
Scheme : 2022

by
[Link].M
Designation:Assistant Professor
Dept of AI and ML
MITE,Moodabidri

10/08/2025 1
10/08/2025 2
10/08/2025 3
10/08/2025 4
10/08/2025 5
10/08/2025 6
Encryption
■ Plaintext(64 bits) → Initial Permutation → 16 Feistel Rounds
(K1 … K16) → Swap → Inverse Initial Permutation →
Ciphertext(64bit)
Decryption:
■ Ciphertext(64bit) → Initial Permutation → 16 Feistel Rounds
(K16 … K1) → Swap → Inverse Initial Permutation → Plaintext
■ the application of the subkeys is reversed.
■ Additionally, the initial and final permutations are reversed

10/08/2025 7
MODULE 1

10/08/2025 8
A model for Network Security

10/08/2025 9
A model for Network Security
Principals: The sender and receiver (e.g., client and server) who must agree on the
communication protocols.
Logical Channel: A virtual path established across the network, enabling reliable data
exchange.
Internet Service: The underlying infrastructure (routers, switches, ISPs) that physically
carries the data.
Protocols: TCP/IP ensures that data is broken into packets, transmitted, and
reassembled correctly.

Two core principles of secure communication.


1. Security-Related Transformation:
■ This is the visible mechanism that alters the message:
■ Encryption: Converts plaintext into ciphertext using an algorithm.
■ Message Authentication Code (MAC): Appends a code derived
from the message and a secret key to verify integrity and
authenticity.
■ Digital
10/08/2025 Signatures: Uses asymmetric cryptography to bind a10
A model for Network Security
2. Shared Secret Information between two principals
■ This is the invisible trust anchor:
■ Symmetric Key: A single shared key used for both encryption and decryption.
■ Asymmetric Keys: Public-private key pairs where the private key remains
secret.
■ Session Keys: Temporary keys negotiated for a single communication session.
Role of a Trusted Third Party (TTP)
• Key Distribution: Ensures secure delivery of secret keys to communicating
parties(2 principals)
• Authentication Authority: Verifies identities and prevents impersonation.
• Arbitration: Resolves disputes over message authenticity or integrity.
• Audit & Logging: Maintains records for accountability and forensic analysis.

10/08/2025 11
A model for Network Security
■ Four Core Tasks in Designing a Security Service

Develop a transformation (e.g., encryption, MAC) that resists


1. Algorithm Design
attacks.
Create cryptographic keys or credentials with sufficient
2. Secret Generation
entropy.
Use secure channels or TTPs to share secrets without
3. Secret Distribution
leakage.
Define how principals use the algorithm and secrets to achieve
4. Protocol Specification
goals like confidentiality, integrity, or non-repudiation.

10/08/2025 12
A model for Network Security

10/08/2025 13
System Intruders

Actor Type Intent Common Actions Risk Level


Non-malicious Probes systems for fun or Medium (still
Curious Hacker
(exploratory) challenge unauthorized)
Sabotage, leaking data, High (trusted
Disgruntled Insider Malicious (retaliatory)
disabling systems access)
Severe
Malicious (profit- Steals credentials, commits
Cybercriminal (targeted and
driven) fraud
stealthy)

Unwanted Access via Malicious Logic


Some attacks involve inserting malicious logic into a computer system that exploits
vulnerabilities. This logic can affect:
•Application programs (e.g., word processors, browsers)
•Utility programs (e.g., editors, compilers, system tools)
Such programs can create two main categories of threats:
■ Information access threats: Intercept or modify data on behalf of users who should
not have access to that data.
■ Service threats: Exploit service flaws in computers to inhibit use by legitimate users.

10/08/2025 14
firewalls, intrusion
detection/prevention systems,
authentication gateway

10/08/2025 15
•Viruses and worms are common forms of malicious software attacks to compromise a computer system.
•Entry Methods:
[Link] media:
•A disk or USB drive may carry unwanted logic hidden inside otherwise useful software.
•When the software is executed, the malicious code activates.
[Link] transmission:
•Malicious code can be inserted into a system via a network connection.
•More critical for network security, because worms can spread quickly without user action
Security Mechanisms Against Unwanted
Access
1. Gatekeeper Function (First Line of Defense)
This layer prevents unauthorized access before it happens.

Mechanism Purpose
Password Authentication Verifies user identity
Detects and blocks known malware
Screening Logic / Antivirus
signatures
Firewalls Filters incoming/outgoing traffic
Access Control Lists (ACLs) Restrict access based on roles or IPs
10/08/2025 16
2. Internal Controls (Second Line of Defense)
■ consists of a variety of internal controls that monitor activity and analyze stored
information in an attempt to detect the presence of unwanted intruders.

Intrusion Detection Systems (IDS) Monitor for suspicious activity


Audit Logs Track user actions and system changes
Behavioral Analytics Detect anomalies in usage patterns
Verify that files and configurations
Integrity Checkers
remain unchanged

10/08/2025 17
Classical encryption techniques:
■ Symmetric cipher model,
■ Substitution ciphers:Caesar Cipher, Monoalphabetic Cipher,
Playfair Cipher, Hill Cipher, Polyalphabetic Ciphers, One time
pad, Steganography.

10/08/2025 18
■ A symmetric encryption scheme has five ingredients
1. Plaintext: This is the original intelligible message or data that is fed into the
algorithm as input.
2. Encryption algorithm: The encryption algorithm performs various substitutions
and transformations on the plaintext.
3. Secret key: The secret key is also input to the encryption algorithm. The key is a
value independent of the plaintext and of the algorithm. The algorithm will produce
a different output depending on the specific key being used at the time. The exact
substitutions and transformations performed by the algorithm depend on the key.
4. Ciphertext: This is the scrambled message produced as output. It depends on the
plaintext and the secret key. For a given message, two different keys will
produce two different ciphertexts. The ciphertext is an apparently random
stream of data and, as it stands, is unintelligible.
5. Decryption algorithm: This is essentially the encryption algorithm run in reverse.
It takes the ciphertext and the secret key and produces the original plaintext.

10/08/2025 19
10/08/2025 20
TWO KEY REQUIREMENTS FOR A SECURE
ENCRYPTION SYSTEM
■ 1. Strong encryption algorithm
Even if an attacker knows the encryption algorithm and gets access to some
ciphertexts, they should not be able to:
 Decrypt the ciphertext (read the message)
 Figure out the secret key
 Stronger requirement: Even if the attacker has pairs of plaintext and their
corresponding ciphertexts, the key should still be impossible to deduce.
■ 2. Secure key distribution & secrecy
 Both sender and receiver must:
– Obtain the secret key securely.
– Keep it private.
 Note: If an attacker discovers the key, they can decrypt all messages
since they also know the algorithm.

10/08/2025 21
ESSENTIAL ELEMENTS OF A SYMMETRIC
ENCRYPTION SCHEME

10/08/2025 22
📜 1. PLAINTEXT (X)
•The source produces a message:X = [X₁, X₂, …, Xₘ]
•M = Number of elements (letters, bits, symbols)
•Traditional Alphabet: 26 uppercase letters (A–Z)
•Modern Systems: Binary data (0s and 1s)

🔒 2. ENCRYPTION ALGORITHM (E)


Combines Plaintext (X) with a Secret Key (K)
Produces Ciphertext Y=[Y₁,Y₂, …, Yₘ]
Y = E(K,X)
Algorithm is public; security depends on the key
CIPHERTEXT (Y) is the Output of the encryption process and Appears random
and unintelligible without the key

🔒 3. DECRYPTION ALGORITHM (E)


Combines ciphertext(X) with a Secret Key (K)
Produces Plaintext Y=[Y₁,Y₂, …, Yₘ]
X= D(K,Y)
Algorithm is public; security depends on the key
PLAINTEXT (Y) is the Output of the decryption process and Appears random
and intelligible without the key
10/08/2025 23
4. SECRET KEY (K)
•Shared between sender and receiver
•Must remain confidential
•Used for both encryption and decryption in symmetric schemes

[Link] Generation
■ A secret key is generated in the form:
K = [K₁, K₂, …, Kⱼ]
■ 1. Generated at the Message Source
 The source creates the key K.
 The same key must be securely sent to the destination.
 Requires a secure channel for key transfer.
■ 2. Generated by a Trusted Third Party
A key distribution center (KDC) or trusted entity generates the key.
The key is securely delivered to both source and destination.
Avoids direct key exchange between the communicating parties.

10/08/2025 24
Attacker’s Goals:
1. Recover X (the plaintext):
• If the attacker only cares about this specific message, they try to guess or compute a plaintext
estimate such that E(K, )) ≈ Y.
2. Recover K (the key):
• If the attacker wants to read future messages, they attempt to estimate the key Kₙ.
• Once K is found, they can decrypt any ciphertext generated with that key.

CHARACTERIZATION OF CRYPTOGRAPHIC
SYSTEMS
Type of Operations
Cryptographic systems can be described along three independent dimensions:
1. Substitution:
Each element in plaintext (bit, letter, group of bits or letters) is mapped into
another element.
2. Transposition:
Elements in the plaintext are rearranged.
• Product Systems:
Most modern algorithms use multiple stages of substitution and transposition.
• Key Requirement:
All operations must be reversible to recover the original plaintext.
10/08/2025 25
10/08/2025 26
Two General Approaches to attacking a conventional encryption scheme:
■ The main goal is usually to recover the secret key in use.
– All past and future messages encrypted with that key are compromised.
■ Recovering just a single plaintext is less important compared to recovering the
key.
1. Cryptanalysis
 Knows the Algorithm (E & D):
The attacker knows how encryption & decryption works.
Example: AES, DES, RSA algorithms are public.
 Has Ciphertext (Y):The attacker can observe encrypted messages.
 May Know Characteristics of Plaintext:
Natural language properties (e.g., common words like "the", "hello").
Standard message formats (headers, timestamps).
 Patterns in repeated messages.
May Have Known Plaintext-Ciphertext Pairs:
Example: The attacker knows X = "Hi" corresponds to Y = <ciphertext>.This
helps the attacker understand how plaintext is transformed..

10/08/2025 27
■ Brute-force attack:
The attacker tries every possible key on a ciphertext.
Continues until intelligible plaintext is obtained.
On average, half of all possible keys must be tried before success.
 Effective only when the key space is small.
 As key length increases, the number of possible keys grows exponentially
 .For large key spaces, brute-force becomes computationally infeasible.
 if there are X different keys, on average an attacker would discover the actual key
after X/2 tries

10/08/2025 28
Key Size Total Possible Keys(key Average Attempts
(bits) space) Needed
4-bit 24=162^4 = 16 ~8 attempts
8-bit 2^8 = 256 ~128 attempts
16-bit 2^{16} = 65,536 ~32,768 attempts

32-bit 2^{32} ≈ 4.29×10⁹ ~2.15×10⁹ attempts

56-bit
2^{256≈7.2×10¹⁶ ~3.6×10¹⁶ attempts
(DES)
128-bit
2^{128} ≈ 3.4×10³⁸ ~1.7×10³⁸ attempts
(AES)

10/08/2025 29
Levels of Information
■ The difficulty of an attack depends on how much information the
cryptanalyst has.
🔒 Ciphertext-Only Attack
■ Most difficult scenario: Only the ciphertext is available.
■ Sometimes, the encryption algorithm is also unknown.
■ In general, it’s assumed the algorithm is known, but the key is secret.
■ Performs brute-force attack:
 If the key space is very large, brute-force becomes impractical.
 Alternative: Ciphertext Analysis -Opponent examines the ciphertext.
Applies statistical tests to find patterns and Look for
frequency distributions
Uses these patterns to guess the key or decrypt part of the
plaintext.
10/08/2025 30
■ The opponent must have a general idea of the plaintext type:
– English or French text
– EXE binary file
– Java source code
– Accounting or database file
– Any format with known structure

10/08/2025 31
10/08/2025 32
Ciphertext-Only Attack
•Easiest to defend against because the opponent has:
•Only ciphertext.
•No knowledge of the original plaintext.
•Provides the least amount of information to work with.

•Electronic funds transfer messages may have a standard banner.


•File formats often have fixed headers or signatures

10/08/202 33
5
■ Probable-Word Attack
Similar to a known-plaintext attack, but instead of knowing exact text:
– The attacker guesses specific words or patterns likely to be in the message.
Works well when:
– The message contains predictable terms.
Examples:
– Accounting file:
– Attacker knows the header likely contains words like “ACCOUNT” or “BALANCE.”
– Source code file:© Corporation X 2025(include a copyright line)
 Chosen-Plaintext Attack:
The attacker manages to insert a message of their choice into the encryption system.
By comparing the chosen plaintext and resulting ciphertext, they can study the encryption
algorithm and deduce the key.
Differential Cryptanalysis:Analyzes differences between pairs of plaintexts and
ciphertexts to break block ciphers.
■ Note:chosen ciphertext and chosen [Link] are less commonly employed as cryptanalytic
techniques but are neverthelesspossible avenues of attack.
■ Weak algorithms: Can be broken with ciphertext-only attacks.
■ Strong algorithms: Can resist even when the attacker knows parts of the plaintext.
10/08/2025 34
■ Unconditionally Secure Encryption:
o An encryption scheme is unconditionally secure if:
o The ciphertext does not contain enough information to uniquely find the plaintext.
o This holds true no matter how much ciphertext is available.
o Even with unlimited time and computing power, decryption is impossible because
the key information is missing.
o Example:One-Time Pad (OTP).
practical security goals for encryption algorithms when perfect (unconditional)
security is not achievable:
1. Cost of breaking > Value of data
The algorithm should be designed so that cracking it would require resources
(money, computation power) much higher than the worth of the information.
Example: If the data is worth ₹10,000, the cost of an attack should be much more
than that, making the attack economically impractical.
2. Time to break > Data's useful lifetime
– Even if an attacker can eventually break the cipher, it should take longer than the
period in which the data is relevant or sensitive.
– 10/08/2025
Example: If a message is only useful for 1 week, the encryption should 35
take years
An encryption scheme is said to be computationally secure if
either of the
■ foregoing two criteria are met. Unfortunately, it is very difficult
to estimate the amount of effort required to cryptanalyze
ciphertext successfully.
•cryptanalysis
small patterns or structures from the plaintext
for symmetric can still remainschemes
encryption visible in the are
ciphertext.
•Cryptanalysis looks for these surviving patterns to find clues about:The plaintext Or the encryption
designed
key.
•Example: Hello Hello --- XZQTW XZQTW

10/08/2025 36
■ Substitution ciphers
1. Caesar Cipher,
2. Monoalphabetic Cipher,
3. Playfair Cipher,
4. Hill Cipher,
5. Polyalphabetic Ciphers,
[Link] time pad,
7. Steganography.

10/08/2025 37
Substitution Techniques
■ The two basic building blocks of all encryption techniques are
1. substitution
2. and transposition.
A substitution technique is one in which the letters of plaintext
are replaced
■ by other letters or by numbers or symbols.
■ If the plaintext is viewed as a sequence of bits, then
substitution involves replacing plaintext bit patterns with
ciphertext bit patterns.

10/08/2025 38
1. Caesar Cipher
•It’s a substitution cipher where each letter in the plaintext is shifted by a fixed number k
down the alphabet.
1. Encryption function:
C = E(k, p) = (p + k) mod 26 ,
■ For example,
plaintext: meet me after the toga party
cipher: PHHW PH DIWHU WKH WRJD SDUWB
When you reach the end of the alphabet (Z) in cipher, it
wrap around to A.

Where:
•p is the numeric value of the plaintext letter (A = 0, B = 1, ..., Z = 25)
•k is the shift value (e.g., 3 in example) .Evaluates to C = E(3, p) = (p + 3) mod 26. where k takes
on a value in the range 1 to 25.
•C is the encrypted letter's numeric value

10/08/2025 39
10/08/2025 40
2. Decryption Function
To reverse it: p = D(k, C) = (C - k) mod [Link] recovers the original letter from
the ciphertext.
■ Three important characteristics of this problem enabled us to use a bruteforce
cryptanalysis:
1. The encryption and decryption algorithms are known.
2. There are only 25 keys to try.
3. The language of the plaintext is known and easily recognizable.
 If the language of the plaintext is unknown, then plaintext output may not be
recognizable and vice versa
 If the plaintext is compressed (e.g., ZIP file) or uses abbreviations, the decrypted data will
not look like normal readable text.
Disadvantage:
With a key space of only 25 possible keys, the Caesar cipher provides very weak security and is
highly vulnerable to brute-force attacks.

10/08/2025 41
2. Monoalphabetic Ciphers

■ the ciphertext alphabet can be any random arrangement of all


26 letters.
■ the “cipher” line can be any permutation of the 26 alphabetic
characters,then there are 26! or greater than 4 * 1026 possible keys
1. First letter: 26 choices
[Link] letter: 25 choices
[Link]: 24 choices ... down to 1.
[Link]: 26 × 25 × 24 × ... × 1 = 26!
■ Example:
Plain: 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
Cipher: Q W E R T Y U I O P A S D F G H J K L Z X C V B N M
■ This is 10 orders of magnitude greater than the key space for DES
and would seem to eliminate brute-force techniques for
cryptanalysis.
10/08/2025 42
■Line of Attack:Illustration on Cryptanalsis
 If the cryptanalyst knows the nature of the plaintext (e.g., noncompressed English
text), then the analyst can exploit the regularities of the language.

Ciphertext
=

■ Frequency Analysis Attack:


Step 1: Count Each Letter:U = x times,Z = x times,…
Step 2: Convert to Relative Frequency (%)
Relative frequency = (count of letter ÷ total letters) × 100.
■ For the given ciphertext:Total letters: 120,Occurrences of 'P’:=16,Relative
frequency of 'P': ≈ 13.33%

10/08/2025 43
Step 3: Compare with English Letter Frequency
 English letters have standard frequencies (E, T, A, O are the most common).
 Compare the ciphertext’s distribution to the standard English distribution (Figure
3.5).
 Example:
– If P is the most frequent letter in the ciphertext and E is the most frequent in
English, you might guess P → [Link] Z → T.

10/08/2025 44
•High-frequency ciphertext letters: S, U, O, M, H
•Likely map to plain letters from {a, h, i, n, o, r, s}
•Low-frequency ciphertext letters: A, B, G, Y, I, J
•Likely map to plain letters from {b, j, k, q, v, x, z}

•Tentative assignments: Start substituting likely letters to form a partial plaintext skeleton.
•Systematic approach: Check for patterns, known words, and repeating cipher sequences to infer mappings.

Digram analysis:
1. The most common digram in English is th.
2. In the ciphertext, the most frequent digram is ZW → assign Z = t and W = h.

Using earlier hypothesis:If Z = t, then P = e (from P/Z high-frequency mapping).

Trigram check:
The sequence ZWP appears in the ciphertext.
Mapping gives the, the most common English trigram.(the)

Four-letter sequence:The sequence ZWSZ can map to th_t.This suggests S = a.

10/08/2025 45
Partially decoded ciphertext:
Even with only four substitutions, a significant “skeleton” of the
plaintext appears. Common patterns like the and that confirm the
mappings are correct.

Continued frequency analysis + digram/trigram matching can


break a monoalphabetic substitution cipher efficiently.
Final decrypted plaintext:

Disadvantage:Monoalphabetic ciphers are easy to break because


they reflect the frequency data of the original alphabet
10/08/2025 46
Homophonic Cipher
•One plaintext letter can be encrypted as many different symbols using numbers only.
•It hides single-letter frequency patterns.
•Example:
•E → can become 16, 74, or 35 (random choice each time).
•H → can become 42 or 99.
•Message: HELLO
•Could encrypt as: 42 16 74 74 35
Now the ciphertext doesn’t show E as the most common symbol because E is split
into multiple different numbers.
Limitation:
patterns of pairs of letters (digrams) still [Link]: If TH occurs a lot in
plaintext, whatever symbols replace T and H will appear together often in
[Link] can still use those patterns to break the cipher.
■ Two ways to make substitution ciphers stronger so that
language(plaintext) patterns don’t show up in the ciphertext
1. encrypt multiple letters of plaintext (encrypt blocks of letters.)
2. Use multiple cipher alphabets
10/08/2025 47
3. Playfair Cipher

■ Type: multiple-letter encryption cipher


■ Unit of encryption: Works with digrams ,instead of single letters.
■ Goal: Obscure single-letter frequency patterns by encrypting two letters at a time.
1. Key Generation:
Keyword:MONA
Create a 5×5 Matrix
RCHY
■ Constructed using a keyword, removing duplicate letters.
■ Remaining letters of the alphabet are filled in order.
■ Usually, I and J are combined to fit 25 letters.

10/08/2025 48
2. Prepare Plaintext: Fill-fi ll-fi lx lx
 Remove spaces, split into digrams. Bottle-bo tt le-bo tx tl
 Insert filler (like ‘X’) if a pair has duplicate letters or odd length.
 Example:
Plaintext: "HIDETHEGOLD“; Digrams: HI DE TH EG
OL DX
3. ENCRYPTION

1. Repeating Letters in a Pair: a digram has the same letter twice, insert a filler ( X).
Example: BA LL OO N → split as BA LX LO ON(odd length). Consider SC HO OL(even
length)

2. Same Row Rule:If both letters are in the same row, replace each with the letter to the right
(wrap around to the first if needed).
Example: AR → RM.
3. Same Column Rule:If both letters are in the same column, replace each with the letter below
(wrap around to the top if needed).
Example: MU → CM.
10/08/2025 49
4. Rectangle Rule:If letters are in different rows and columns, form a rectangle and replace each letter
with the one in its own row but the other letter’s column.
Example:HS → BP,EA → IM (or JM, depending on the I/J convention).

Playfair cipher advantage:


•Works with 676 digrams (26×26) instead of 26 single letters, making pattern recognition
harder.
•Letter frequencies vary more widely than digram frequencies, so traditional single-letter
frequency analysis is less effective. Single-letter frequencies
In English text, common digrams like: In English text:
•TH ≈ 3% •E ≈ 13%
•HE ≈ 2.5% •T ≈ 9%
•IN ≈ 2% •Z ≈ 0.1%
👉 These numbers are much closer 👉 You can clearly see E appears way more
together. than Z.
10/08/2025 That big difference helps a cryptanalyst guess which cipher 50
4. Decryption Rules for Playfair Cipher
■ To decrypt, you reverse the encryption steps using the same 5×5 key matrix.
■ Remove the Filler.

■ Efficiency of the Playfair Cipher


Plaintext: THIS IS A SECRET MESSAGE
Step 1: Count letters (ignore spaces):T:2, H:1, I:2, S:5, A:2, E:4, C:1, R:1, M:1, G:1
E appears 4 [Link], use 4 as the normalizing divisor
Step 2: Normalize plaintext frequencies (divide by 4):
S:5/4 = 1.25;E:4/4 = 1.0;T:2/4 = 0.5;I:2/4 = 0.5;A:2/4 = 0.5;H:1/4 = 0.25;C:1/4 = 0.25;R:1/4 =
0.25;
M:1/4 = 0.25;G:1/4 = 0.25
Step 3: Ciphertext (Using Playfair):QFUZWLQFZTYOQLHTYWLQZ
Step 4: Count letters(Ciphertext)=Q:5, F:2, U:2, Z:3, W:2, L:2, T:2, Y:2, O:1, H:1
Step 5: Normalize ciphertext frequencies (divide by 4, the plaintext E count):
Q:5/4 = 1.25; Z:3/4 = 0.75; F:2/4 = 0.5; U:2/4 = 0.5; W:2/4 = 0.5; L:2/4 = 0.5; T:2/4 = 0.5; Y:2/4
= 0.5
O:1/4 = 0.25;H:1/4 = 0.25
Observation:In plaintext, some letters (like S or E) occur a lot more than others → big peaks and
deep valleys on the graph.
In Playfair, because it encrypts pairs of letters (digrams), the ciphertext spreads out letter
[Link] most frequent letter’s count goes [Link] least frequent letters’ counts go up a
10/08/2025 51
10/08/2025 52
■ multilettered cipher developed by Lester Hill.
[Link] Cipher
1. Prepare Plaintext:
 Assign numerical values
•a = 0, b = 1, c = 2, … z = 25; Example: HELLO → h=7, e=4, l=11, l=11, o=14
 Divide the text into blocks of m letters
 Choose m=2,3,4,…m = 2, 3, 4, … depending on the size of the key matrix.
 Example: If m=3 split plaintext into 3-letter groups.
 If the plaintext length is not divisible by m, add filler letters (usually ‘x’).
 For m = 3:Plaintext = HELLO → length = [Link] into: HEL | LO. Second block has only 2
letters, so pad with ‘X’:HEL | LOX
k11 k12 k1m
2. Key Generation
The key is a square matrix of size mxm ;m->size of the block
k21 k22 k2m
Denoted as [Link] element of the matrix is ki,j is shown Kbelow
=
.. .. ..
. . .
10/08/2025 53
Encryption
If we call m characters in the plaintext block P1, P2 … Pm the
corresponding characters in the ciphertext blocks are C1, C2 … Cm .
C1=(P1k11+ P2 k21+…+ Pm km1) mod26
C2=(P1k12+ P2 k22+ …+Pm km2) mod26

Cm=(P1k1m+ P2 k2m2+…+ Pmkmm) mod26
This can be expressed in terms of row vectors and matrices
k11+ k21+…+ km1 mod26
k12+ k22+ …+ km2 mod26 C = PK mod 26
C1 C2 …Cm (P1 P2 …

= P m) k1m+ k2m2+…+ kmm mod26

where C and P are row vectors of length m representing the


plaintext and ciphertext,
K is10/08/2025
a mXm matrix representing the encryption key. Operations are
54
Example
■ For m = 3, the system can be described as

10/08/2025 55
[Link]

10/08/2025 56
Illustration
Encrypt Plaintext= pay more money(15 letter) and key is

[Link] space and divide into trigram.

C = PK
2. Encryption: using row vectors: mod 26

10/08/2025 57
Final Ciphertext:

10/08/2025 58
Illustration for Decryption

Step 1: Compute
determinant of K
For a 3×3 matrix:
det⁡(K)=a(ei−fh)−b(di−fg)
+c(dh−eg)

10/08/2025 59
10/08/2025 60
10/08/2025 61
■ 1. Known Plaintext Attack
The biggest weakness of Hill cipher is that it is linear:
C=P⋅K(mod26)
If an attacker knows enough plaintext–ciphertext pairs, they can set up a
system of linear equations to solve for the key matrix K.
2. Chosen Plaintext Attack
■ If an attacker can choose plaintexts and get the ciphertexts:
– Send special plaintexts like [1,0,0], [0,1,0],[0,0,1] (basis vectors).
– The ciphertexts directly reveal the columns of K.
■ This breaks the cipher with very few queries.
– However, for small block sizes (e.g., m=2), digraph frequency
analysis can still leak information.
■ 4. Brute-Force Attack

10/08/2025 62
Polyalphabetic Ciphers

1. VIGENÈRE CIPHER-Autokey
2. Vernam Cipher
3. One-time Pad
■ polyalphabetic substitution cipher techniques have the following
features in common:
■ 1. A set of related monoalphabetic substitution rules is used.
■ 2. A key determines which particular rule is chosen for a given
transformation.

10/08/2025 63
Vigenere Cipher
■ a polyalphabetic cipher built from 26 Caesar shifts.

3. Encryption

10/08/2025 64
■ the first letter of the key is added to the first letter of the plaintext, mod 26,the
second letters are added, and so on through the first m letters of the plaintext.
■ For the next m letters of the plaintext, the key letters are repeated
Decryption

When the plaintext length n is greater than the key length m, the key is repeated cyclically. That
is, the key letter used for the i-th plaintext letter is

Illustration

1. Plaintext:
WEAREDISCOVEREDSAVEYOURSELF
Key: of keyDECEPTIVEDECEPTIVEDECEPTIVE
Length m = 9, so we repeat it until it matches the plaintext length
n=27.

2. Convert letters to numbers(both key and


plaintext)

10/08/2025 65
P (plain C
Value K (key) Value Sum Mod 26
text) (cipher)
W 22 D 3 25 25 Z
E 4 E 4 8 8 I
A 0 C 2 2 2 C
R 17 E 4 21 21 V
E 4 P 15 19 19 T
D 3 T 19 22 22 W
I 8 I 8 16 16 Q
S 18 V 21 39 13 N
C 2 E 4 6 6 G
O 14 D 3 17 17 R
V 21 E 4 25 25 Z
E 4 C 2 6 6 G
R 17 E 4 21 21 V
E 4 P 15 19 19 T
D 3 T 19 22 22 W
S 18 I 8 26 0 A
A 0 V 21 21 21 V
V 21 E 4 25 25 Z
E 4 D 3 7 7 H
Y 24 E 4 28 2 C
O 14 C 2 16 16 Q
U 20 E 4 24 24 Y
R 17 P 15 32 6 G
S 18 T 19 37 11 L
E 4 I 8 12 12 M
10/08/2025 L 11 V 21 32 6 G 66
Advantages
■ Multiple ciphertext letters per plaintext letter → hides frequency distribution
depending on which key letter is [Link]:e is encrypted to i,t etc. Thus, the
letter frequency information is obscured.
Limitations
1. When the Vigenère cipher uses a keyword of length m, it’s like applying m separate
Caesar ciphers in a cycle.
■ Example:If the keyword length is 9, then:
o Letters in positions 1, 10, 19, 28… are encrypted with the same shift.
o Letters in positions 2, 11, 20, 29… are encrypted with another shift.
o … and so on until the 9th shift, then the cycle repeats.
use the known frequency characteristics of the plaintext language to attack each of the
monoalphabetic
2. ciphers separately
Repeated patterns in plaintext → repeated ciphertext patterns at
predictable intervals → lets you guess key length.
Look for the word "red" in plaintext:
•In positions 4–6: r e d
•In positions
10/08/2025 13–15: r e d 67
■ AUTOKEY SYSTEM,
• Start with a short keyword (seed).
• After that keyword, instead of repeating it, append the plaintext itself until it’s as long as
the message.
• This way, no periodic repetition — the key is unique for the whole message

Limitation
in a long ciphertext, an attacker will see more than expected cases where encryption is
“letter encrypted by itself” — and that’s a statistical fingerprint they can exploit.
The probability of “Plaintext E” and “Key E” lining up is:
P(E in plaintext) × P(E in key) = 0.127 × 0.127 ≈ 0.016 (1.6%).Similarly for letter t and others
letters)

10/08/2025 68
Vernam Cipher
■ Gilbert Vernam proposed:
o Use a key as long as the message.
o The key must be truly random.
o Key is used only once → then destroyed.
■ There is no repetition and no statistical link between plaintext and ciphertext .

10/08/2025 69
Decryption:
■ decryption simply involves
■ the same bitwise operation:

Drawbacks:
■ Key repetition → Once the key loops, patterns can appear and frequency
analysis becomes possible
■ Breakable with enough ciphertext → If an attacker knows or guesses
part of the plaintext, they can work out key segments and decrypt the
rest.

10/08/2025 70
One Time Pad(OTP)
■ Mauborgne took Vernam’s idea and fixed its biggest weakness — the repeating
key — by making it:
1. Truly random
2. As long as the message
3. Used only once and then destroyed
■ This transforms Vernam’s cipher into what we now call the One-Time Pad (OTP).
■ unbreakable:
1. With a random key as long as the plaintext, there’s no repetition to exploit.
2. Every possible plaintext of that length is equally likely given the ciphertext —
meaning cryptanalysis can’t narrow it down.
3. The output looks like pure noise (random bits), so statistical attacks fail.

10/08/2025 71
For OTP with an alphabet of 27 symbols (A–Z plus space)

10/08/2025 72
Two fundamental difficulties:
1. Generating Truly Random Keys requires generating millions of random
bits or characters at scale is hard.
2. Key Distribution and Protection: The sender and receiver must share
a key that is:
As long as the message
Used only once
Kept completely secret
Challenge: If you're sending a 1MB message, you need to securely
share a 1MB key beforehand.
Real-world issue: This creates a massive logistical burden.
Advantages:
1. Useful primarily for low-bandwidth channels requiring very high security
for short critical messages.
10/08/2025 73
Stegonography
■ A plaintext message may be hidden in one of two ways.
■ The methods of steganography conceal the existence of the message,
whereas the methods of cryptography render the message unintelligible
to outsiders by various transformations
■ Various other techniques have been used historically:

10/08/2025 74
Modern Steganography: Least Significant Bit (LSB) Encoding
LSB hides data in the least significant bits of image pixels — is one of the most
widely used digital steganographic methods.
■ Every image on a computer is made of [Link] pixel has a color, which is stored
in binary
(0s and 1s).
■ Example:A pixel color value might look like 10110011 (in binary).
■ The last bit (the rightmost one: 1) is called the Least Significant Bit (LSB).
■ If we change only this last bit, the color change is so small that the human eye
usually cannot notice.
■ That’s why we can hide secret data inside these LSBs.
Example : Kodak Photo CD Format
Resolution = 3096 × 6144 pixels.
■ Total pixels = 3096 × 6144 = 19,011,264 pixels (≈ 19 million).3.
■ How Much Data Can Be Hidden?
If we hide 1 bit in each pixel → we can hide 19 million bits.
19 million bits ÷ 8 = 2.3 MB of secret data.
10/08/2025 75
Drawbacks:

1. High Overhead, Low Payload:to hide a relatively few bits of information,requires


a large cover object (like an image or audio file) to hide a small amount of data.
•Example: Hiding a 130 KB message might require a 7 MB image.
•Why it matters: This makes steganography inefficient for large-scale or high-volume
communication.
2. Once Discovered, It’s Compromised:If someone figures out your hiding method,
they can extract or destroy the hidden data. Unlike encryption, which remains secure
as long as the key is secret, steganography’s security often depends on secrecy of the
Alternative method of
method itself.

Steganography
■ Step 1: Encrypt the Message
■ Use a strong cipher (e.g., AES) to scramble the message.
■ Now the message is unreadable without the key.
■ Step 2: Hide the Encrypted Message
■ Embed the ciphertext inside an image, audio file, or video using
steganography.
■ Advantages
[Link] the existence of communication by embedding image or audio
10/08/2025 76
10/08/2025 77
Block Ciphers and Data Encryption Standards:
Traditional Block Cipher structures,
Data Encryption Standard (DES),
A DES Example,
The strength of DES,
Block cipher design principles

10/08/2025 78
Traditional Block Cipher structures

•What is a Stream Cipher?


•A stream cipher encrypts data one bit or one byte at a time,
instead of whole blocks. Classical examples
1. Autokeyed Vigenère cipher (uses parts of the plaintext as part of the key).
2. Vernam cipher (XOR the plaintext with a keystream).
•Ideal case (one-time pad) →
1. The keystream is truly random.
2. The keystream is exactly the same length as the message.
3. The keystream is never reused.
•Main problem → Secure key distribution to both the parties in advance via some
completely secure, separate channel.
•Logistical nightmare → For large amounts of data, securely distributing huge
random keys becomes impractical
10/08/2025 79
■ Practical Solution
■ Instead of sending a huge keystream, both sides share a small secret key.
■ A bit-stream generator (pseudo-random generator) expands this key into a long
keystream.
■ Requirements:Output must be cryptographically strong → unpredictable.
■ Future keystream bits cannot be guessed from past ones.

10/08/2025 80
What is Block Cipher
■ A block cipher is one in which a block of plaintext is treated as a whole and used to produce a
ciphertext block of equal length.
■ Typically, a block size of 64 or 128 bits is used. As with a stream cipher, the two users share a
symmetric encryption key (Figure 4.1b).
■ In general, they seem applicable to a broader range of applications than stream ciphers. The vast
majority of network-based symmetric cryptographic applications make use of block ciphers.
■ Some key modes where a block cipher works like a stream cipher:eg:[Link]

10/08/2025 81
Motivation for the Feistel Cipher
Structure
■ A block cipher maps an n-bit plaintext block → n-bit ciphertext block.
■ There are 2n possible plaintexts.
■ Reversible Mapping (Or) Non-Singular Mapping
every plaintext must map to a unique ciphertext. Inorder for the
encryption to be reversible.
 That means no two plaintexts are allowed to have the same ciphertext.
 In math terms: the mapping must be a permutation of the 4 possible
blocks.

Here, all 4 ciphertexts


are
different:
{11,10,00,01}
So if I see ciphertext
= 10, I
know the plaintext m
ust have
been 01.

10/08/2025 82
Irreversible Mapping or Non-Singular
■ If two different plaintexts map to the same ciphertext → decryption is
ambiguous (not possible).

Plaintext 10 → 01
ciphertext Plaintext 11
→ 01 ciphertext
Now ciphertext 01 could
mean two different
plaintexts
(either 10 or 11).

10/08/2025 83
■ Fiestel Ideal Block Cipher
1. Ideal Block Cipher Block size = 4 bits
2. A 4-bit input can take 16 different values (from 0000 to 1111, i.e., 0 to 15
in decimal).These are called the 16 possible input states.
3. For 16 inputs, we can arrange them in 16! different permutations.
4. Substitution Cipher Mapping: Each 4-bit input must be mapped to a unique
4-bit output. The output is also one of the 16 possible states (0000 – 1111).
5. The mapping must be one-to-one (bijective) so that decryption is possible.
■ Input 0000 might map to output 1010.
■ Input 0001 might map to output 0111.…and so on.
■ No two inputs can map to the same output (otherwise
decryption fails).

10/08/2025 84
Substitution
Wiring

The mapping (the “wires” in the gray box) is the key.


To describe the mapping explicitly, you need to list the ciphertext for each plaintext.
Key size:
For n=4: 16 rows, each row needs 4 bits = 4×16=64
For n=64, 264 rows, each rows needs 64 bits=64 x 264= 270(to thwart statistical attack
Generally, Key size= n . 2n(
Instead,
10/08/2025
real block ciphers like AES use structured transformations
85
(S-b
practical problem with the ideal block cipher.
■ Small 𝑛 → behaves like a classical substitution cipher → breakable by frequency
analysis.
■ Large 𝑛 → plaintext statistics are hidden → cryptanalysis by frequency becomes
infeasible.
■ Real ciphers (AES, DES) approximate the ideal block cipher using clever structures
instead of giant lookup tables.

In an ideal block cipher, this storage is equivalent


to the “key” because it completely defines the
cipher.

10/08/2025 86
Fiestel Cipher
■ Feistel (1973) product ciphers:
Product Cipher = Combination (sequence) of simpler transformations →
substitution + permutation, repeated in multiple rounds.
■ Instead of having (2n)! transformations, a block cipher is designed with:
o Block size = nbits.
o Key size = k bits.
o Possible transformations = 2k (manageable).
Feistel suggested alternating substitutions and permutations:
1. Substitution: Each plaintext element (bit, nibble, byte, or block) is
replaced by a corresponding ciphertext element.
00 → 11 If plaintext = 0110, after substitution → 1001.
01 → 10 Purpose: Adds confusion (hides relation between ciphertext
10 → 01 and key).
11 → 00
2. Permutation (P-box):Rearranges (shuffles) the positions of [Link]
10/08/2025 87
■ The two basic building blocks for any cryptographic system suggested by Shannon
to thwart statistical cryptanalysis:
1. Diffusion:
■ In diffusion, the statistical structure(letter freqyency) of the plaintext is dissipated
into long-range statistics of the ciphertext.
■ Make each ciphertext digit depend on many plaintext digits, and each plaintext
digit influence many ciphertext digits.
This ensures that frequency analysis and other statistical attacks no longer work.
■ Shannon illustrated diffusion using a simple averaging operation.
■ Message:M=m1,m2,m3,… where each mi​is a number representing a letter (say 0–
25 for A–Z).

10/08/2025 88
■ Plaintext (e.g., English text) → has uneven statistics (e.g., "E" is very frequent,
"Q" is rare, "TH" appears often).
■ Ciphertext after diffusion → these frequencies are “flattened” → ciphertext looks
random, without obvious statistical spikes.
■ In binary block ciphers, this flattening is achieved by:
1. Permutation of bits (rearranging them).
2. Mixing functions applied repeatedly (so each ciphertext bit depends on multiple
plaintext bits).
■ Result:
Plaintext Even
block: if one plaintext bit flips, many ciphertext bits flip → avalanche effect.
10110011
Step 1: Permutation → shuffle positions (e.g., [3,1,4,2,7,5,8,6]) → 11001011
Step 2: Mixing function (e.g., XOR adjacent bits in pairs):
11 → 0 00 → 0 10 → 1 11 → 0 Output ciphertext : 0010
Avalanche Effect:
Each ciphertext bit depends on several different plaintext bits.
One plaintext bit contributes to many ciphertext positions.
Frequency distributions of letters/digrams/trigrams in text are destroyed.

10/08/2025 89
2. Confusion:

■ Make the relationship between the ciphertext statistics and the key as
complex as possible.
■ Goal: Prevent attacker from deducing the key structure from
ciphertext.
■ Effect: Even if an attacker notices patterns in ciphertext, the way the
key influenced them is so tangled that solving for the key is infeasible.
■ Mechanism: Complex, nonlinear substitution functions (S-boxes).
■ Example:In AES → 8×8 nonlinear S-box. , In DES → 8 different 6→4 bit
S-boxes.
■ Diffusion + Confusion → ciphertext looks random, with no visible link
to either plaintext or key → have become the cornerstone of modern
block cipher design.

10/08/2025 90
10/08/2025 91
Fiestel Cipher Structure
ENCRYPTION
1. Inputs
Plaintext block of size 2w bits (e.g., 64 bits for DES → split into 32-bit halves).
Key (K), from which subkeys (K₁, K₂, …, Kₙ) are derived using a key scheduling
algorithm.
2. Initial Split
Plaintext is divided into two halves:
1. Left half (LE₀) 2. Right half (RE₀)

3. Rounds (n rounds, typically 16 in DES)

4. After the Final Round


The two halves (LEₙ, REₙ) are recombined to form the ciphertext block.
In some designs (like DES), a final swap of halves is done before output.
10/08/2025 92
10/08/2025 93
This structure is a particular form of the substitution-permutation network(SPN)
proposed by Shannon.

10/08/2025 94
Decryption

10/08/2025 95
10/08/2025 96
Design considerations for Feistel ciphers
1. Block size
This is how many bits of plaintext (or ciphertext) are processed in one block.
Larger block sizes → more diffusion (bits get mixed better), harder for attackers to
find patterns.
But the cost is slower performance, since each block is bigger.
Classic Feistel ciphers (like DES) used 64-bit blocks.
■ Key Size: Modern ciphers (like AES, though not Feistel-based) use 128-bit blocks
for stronger security. Larger key → exponentially harder for brute-force
[Link]-bit (DES) → breakable today.128-bit (AES standard) → very
[Link]: more storage and possibly slower key scheduling.

■ Fast software encryption/decryption: In many cases, encryption is embedded in


applications or utility functions in such a way as to preclude a hardware
[Link], the speed of execution of the algorithm becomes a
concern.
10/08/2025 97
THE DATA ENCRYPTION STANDARD(DES)

10/08/2025 98
■ DES Encryption Formula (based on the figure)
1. Input:
Plaintext P : 64 bits
Key K : 64 bits
2. Initial Permutation:

3. Key Schedule
Apply Permuted Choice 1:
Round key size is
48-bit

10/08/2025 99
4. Feistel Rounds
For i=1,…,16

5. Preoutput (after 16 rounds)

6. Final Step

10/08/2025 100
Encryption
■ Plaintext(64 bits) → Initial Permutation → 16 Feistel Rounds
(K1 … K16) → Swap → Inverse Initial Permutation →
Ciphertext(64bit)
Decryption:
■ Ciphertext(64bit) → Initial Permutation → 16 Feistel Rounds
(K16 … K1) → Swap → Inverse Initial Permutation → Plaintext
■ the application of the subkeys is reversed.
■ Additionally, the initial and final permutations are reversed

10/08/2025 101
Step 1: Plaintext in binary
02468aceeca86420 (hex) → 64 bits:
02468aceeca86420
0000 0010 0100 0110 1000 1010 1100 1110 1110 1100 1010 1000 0110 0100
0010 0000 bits:

1................................................................................................................................
...............
■ 0000 |640010 | 0100 | 0110 |
■ 1000 | 1010 | 1100 | 1110 |
■ 1110 | 1100 | 1010 | 1000 |
■ 0110 | 0100 | 0010 | 0000

■ 2. DES IP Table: The IP reorders bits in this pattern:


58 50 42 34 26 18 10 2
60 52 44 36 28 20 12 4
62 54 46 38 30 22 14 6Full IP result:After applying all 64
64 56 48 40 32 24 16 8mappings, we get: 5a005a00
57 49 41 33 25 17 9 13cf03c0f
59 51 43 35 27 19 11 3Splitting: L0 = 5a005a00 R0 = 3cf03c0f
61 53 45 37 29 21 13 5
10/08/2025 63 55 47 39 31 23 15 7 102
The Avalanche Effect
■ A desirable property of any encryption algorithm is that a small change in
either the plaintext or the key should produce a significant change in the
ciphertext.
■ In particular, a change in one bit of the plaintext or one bit of the key should
produce a change in many bits of the ciphertext. This is referred to as the
avalanche effect.
■ If the change were small, this might provide a way to reduce the size of the
plaintext or key space to be searched.

10/08/2025 103
Strength of DES
1. Use of 56-bit Key

10/08/2025 104
The Nature of the DES Algorithm
■ DES uses 8 S-boxes for substitution in each round.
■ The S-box design was secret, raising concerns about hidden weaknesses.
■ Despite some discovered regularities, no fatal flaw has been found in DES S-boxes.
■ DES is insecure today mainly due to its short 56-bit key, not because of S-box weaknesses.
Timing Attacks
A timing attack is when an attacker learns information about a key or plaintext by measuring how long
decryption or encryption takes.
Algorithms may take slightly different amounts of time depending on the input data or key.
Hamming weight:Some timing attacks can reveal the Hamming weight of the key (number of 1s in the
key).This doesn’t reveal the full key but gives partial information.
DES resistance:Studies show DES is fairly resistant to timing attacks.
:Stronger symmetric ciphers like Triple DES and AES are even less vulnerable to timing attacks.
Practicality:So far, timing attacks are unlikely to succeed against DES or modern symmetric ciphers.

10/08/2025 105
■ BLOCK CIPHER DESIGN PRINCIPLES
Three critical aspects of block cipher design:
1. the number of rounds,
2. 2. design of the function F, and
3. 3. key scheduling.

4. The security of a Feistel cipher depends heavily on the number of rounds, along with the round function 𝐹 and the
1. Number of Rounds in Feistel Ciphers

5. More rounds generally make the cipher harder to break, even if 𝐹F itself is relatively [Link] the Number
key schedule.

of Rounds

6. If DES had 15 or fewer rounds, differential cryptanalysis would require less effort than brute force, making it more
vulnerable.

10/08/2025 106
■ Role of Function F:
F is the heart of a Feistel cipher, providing [Link] hides the relationship between
plaintext, ciphertext, and the key.
A well-designed F makes it difficult to reverse (or “unscramble”) the transformations.
The more nonlinear F is, the harder cryptanalysis becomes.
Avalanche Properties

• A small change in input should cause a large change in [Link] ensure


that small differences in plaintext or key propagate through the cipher,

• Strict Avalanche Criterion (SAC):For any output bit 𝑗, flipping a single


making patterns harder to detect.

input bit 𝑖 should change 𝑗 with probability 1/[Link] ensures maximum

• Bit Independence Criterion (BIC):Output bits 𝑗 and 𝑘 should change


diffusion at the level of individual bits.

independently when any single input bit 𝑖 is [Link] strengthens the


confusion function, making cryptanalysis more difficult.

10/08/2025 107
■ Nonlinearity
■ Nonlinear functions are hard to approximate with linear equations.
■ The more nonlinear F is, the harder cryptanalysis becomes.

Note:A good F function is nonlinear, has strong avalanche properties, and


satisfies SAC & BIC, providing robust confusion in the cipher.
3. Key Schedule Algorithm
In a Feistel cipher, the main key is used to generate a different subkey for each
[Link] round’s security depends on the subkey, so the key schedule is critical.
Design Goals
Make it hard to deduce individual subkeys.
Make it hard to work backward to the main key from the subkeys or ciphertext.
Essentially, the key schedule should strengthen the overall security of the cipher.
it should maximize confusion and avalanche effects to prevent attackers from
deducing subkeys or the main key.

10/08/2025 108

You might also like