Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
23 views13 pages

Module 5 Ecs

This document provides a comprehensive overview of cryptography concepts and techniques, including definitions, goals, and various methods such as substitution and transposition techniques. It discusses symmetric and asymmetric key cryptography, steganography, key sizes, and potential attacks on cryptographic systems. The document emphasizes the importance of encryption for data confidentiality and integrity, as well as the trade-offs between security and performance.

Uploaded by

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

Module 5 Ecs

This document provides a comprehensive overview of cryptography concepts and techniques, including definitions, goals, and various methods such as substitution and transposition techniques. It discusses symmetric and asymmetric key cryptography, steganography, key sizes, and potential attacks on cryptographic systems. The document emphasizes the importance of encryption for data confidentiality and integrity, as well as the trade-offs between security and performance.

Uploaded by

sufiyabegum07
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Module-5

Cryptography Concepts and Techniques: Introduction, plain text and cipher


text, substitution techniques, transposition techniques, encryption and
decryption, symmetric and asymmetric key cryptography, steganography, key
range and key size, possible types of attacks.

Cryptography Concepts and Techniques:


Introduction:

Definition: Cryptography is the practice and study of techniques for securing communication
and data in the presence of adversaries.

Main Goals:

Confidentiality: Ensuring only authorized parties can read the message.

Integrity: Ensuring the message is not altered.

Authentication: Verifying the identity of the sender.

Non-repudiation: Preventing the sender from denying the message.

Plain Text and Cipher Text:


Plain Text: The original, readable message or data (e.g., "HELLO").

Cipher Text: The unreadable, encrypted version of the plain text (e.g., "KHOOR").

Encryption: Process of converting plain text into cipher text using an algorithm and a key.

Decryption: Reversing cipher text back to plain text using the key.
Substitution Techniques:
Definition: Substitution techniques are classical encryption methods where elements (usually
letters) of the plaintext are replaced by other elements to produce ciphertext.

1. Monoalphabetic Substitution Cipher

 Each character in the plaintext is replaced by another fixed character from a single
substitution alphabet.
 Example:
o Plain: A B C D E
o Cipher: Q W E R T
o "BAD" → "WQR"
 Vulnerability: Easily broken using frequency analysis because each letter has a one-
to-one mapping.

2. Caesar Cipher (Shift Cipher)

 A type of monoalphabetic cipher where each letter is shifted by a fixed number of


positions in the alphabet.
 Example (Shift = 3):
o Plain: A B C D E
o Cipher: D E F G H
o "HELLO" → "KHOOR"
 Formula:
o Encryption: E(x) = (x + n) mod 26
o Decryption: D(x) = (x - n) mod 26
 Vulnerability: Only 25 possible keys → easily brute-forced.

3. Polyalphabetic Substitution Cipher

 Uses multiple substitution alphabets to encrypt the message.


 Each letter of the plaintext is encrypted using a different Caesar cipher, controlled
by a keyword.

Vigenère Cipher (most well-known polyalphabetic cipher)

 Uses a repeating keyword to shift letters.


 Example:
o Plaintext: A T T A C K
o Key: L E M O N L
o Ciphertext: L X F O P V
 Vulnerability: More secure than monoalphabetic, but still breakable using Kasiski
and frequency analysis methods if key is reused.

4. Playfair Cipher

 Encrypts pairs of letters (digraphs) using a 5×5 matrix filled with a keyword
(duplicates removed).
 Rules:
o Same row → replace with letter to the right.
o Same column → replace with letter below.
o Otherwise → form a rectangle and replace each letter with the one in the same
row but opposite corner.
 Example Keyword: MONARCHY
 Plaintext: "BALLOON" → digraphs → "BA", "LX", "LO", "ON" → Ciphertext

5. One-Time Pad

 Uses a random key as long as the message.


 Encryption: Each letter of the message is shifted by the corresponding letter in the
key.
 Unbreakable if:
o Key is random
o Key is used only once
o Key is kept secret
 Drawback: Key management is difficult.

Transposition Techniques:
Definition:
Transposition techniques rearrange the position of characters in the plaintext, rather than
replacing the characters themselves.

Key idea: The plaintext letters remain the same, but their order is changed to form
ciphertext.

1. Simple (Columnar) Transposition Cipher

 Step 1: Write the plaintext in rows under a key (keyword).


 Step 2: Rearrange the columns in alphabetical order of the keyword.
 Step 3: Read the columns vertically to get the ciphertext.
Example:

 Plaintext: WE ARE DISCOVERED


 Keyword: ZEBRAS
(Assign column numbers based on alphabetical order of keyword: Z=6, E=2, B=1,
R=5, A=0, S=4)

Z EBRA S
WEARE D
I S C OVE
R E DXXX

 Reorder columns by alphabetical order of keyword: A (col 4), B (col 2), E (col 1), etc.
 Ciphertext (read column-wise): EVXLAXACEDSEXRWROIDX

2. Double Transposition Cipher

 Apply two rounds of columnar transposition using two different keys.


 Increases security significantly.
 Used historically in military communications.

3. Rail Fence Cipher (Zigzag Cipher)

 A type of transposition cipher where the message is written in a zigzag pattern on


multiple "rails" (rows), then read row by row.

Example:

Plaintext: HELLO WORLD


Rails = 3

mathematica
CopyEdit
H L O L
E L O W R D
L W D

Read row-wise: HLOELWRD

 Encryption: Write in zigzag → read row-wise.


 Decryption: Reverse the zigzag placement.
Comparison: Substitution vs Transposition

Feature Substitution Transposition


Action Replaces characters Rearranges characters
Character change Yes No
Frequency pattern Altered Retained
Resistance Weaker to frequency analysis Stronger, but can be guessed
Examples Caesar, Monoalphabetic Columnar, Rail Fence

Advantages of Transposition Techniques

 Preserves letter frequencies → harder to detect by frequency analysis alone.


 When combined with substitution (e.g., product ciphers), creates strong encryption.

Encryption and Decryption:

Definition:
 Encryption is the process of converting plain text (readable data) into cipher text
(unreadable format) using an algorithm and a key, to protect data from unauthorized
access.
 Decryption is the reverse process — converting cipher text back into plain text using
a key.

The purpose is to ensure confidentiality — only authorized users can read the message.

Basic Terms

Term Meaning
Plain Text The original message to be encrypted.
Cipher Text The encrypted (scrambled) message.
Key A secret value used in the encryption/decryption process.
Algorithm The method or rule used for encryption and decryption.

Process Overview

1. Encryption

text
CopyEdit
Plain Text + Key → [Encryption Algorithm] → Cipher Text

2. Decryption

text
CopyEdit
Cipher Text + Key → [Decryption Algorithm] → Plain Text

Types of Encryption

1. Symmetric Key Encryption

 Same key is used for both encryption and decryption.


 Fast, but key must be securely shared between sender and receiver.

Examples:

 AES (Advanced Encryption Standard)


 DES (Data Encryption Standard)

text
CopyEdit
Sender: Plain Text + Key → Cipher Text
Receiver: Cipher Text + Same Key → Plain Text

2. Asymmetric Key Encryption

 Uses a pair of keys: a public key (for encryption) and a private key (for decryption).
 More secure for communication but slower.

Examples:

 RSA
 ECC (Elliptic Curve Cryptography)

text
CopyEdit
Sender: Plain Text + Receiver’s Public Key → Cipher Text
Receiver: Cipher Text + Receiver’s Private Key → Plain Text

Why Use Encryption?

 To protect confidentiality of sensitive data (e.g., passwords, financial info).


 To enable secure communication over untrusted networks (e.g., the internet).
 Used in applications like:
o Online banking (HTTPS)
o Email security (PGP, S/MIME)
o Data storage (disk encryption)
Example (Simple Caesar Cipher):

 Plain Text: HELLO


 Key: 3 (shift each letter by 3)
 Cipher Text: KHOOR

Decryption with same key (3): KHOOR → HELLO

Symmetric vs Asymmetric Key Cryptography:

1. Symmetric Key Cryptography

 Definition: Encryption and decryption use the same secret key.


 Key Point: Both sender and receiver must have the same key, which must be kept
secret.

Features:

 Fast and suitable for encrypting large amounts of data.


 Less complex algorithms.
 Key exchange must be done securely beforehand.
 Not scalable for large networks.

Examples:

 AES (Advanced Encryption Standard)


 DES (Data Encryption Standard)
 RC4, RC5, Blowfish

Example Process:

text
CopyEdit
Plain Text + Secret Key → Encryption → Cipher Text
Cipher Text + Same Key → Decryption → Plain Text

2. Asymmetric Key Cryptography (Public Key Cryptography)

 Definition: Uses a pair of keys: a public key (for encryption) and a private key (for
decryption).
 Key Point: Public key can be shared; private key is kept secret.

Features:

 Solves the key distribution problem.


 Slower due to more complex mathematical operations.
 Enables digital signatures, secure key exchange, etc.
 More scalable for large networks.

Examples:

 RSA
 ECC (Elliptic Curve Cryptography)
 DSA (Digital Signature Algorithm)

Example Process:

text
CopyEdit
Plain Text + Receiver's Public Key → Encryption → Cipher Text
Cipher Text + Receiver's Private Key → Decryption → Plain Text

Comparison Table

Feature Symmetric Key Asymmetric Key


Keys Used Same key Public and private key pair
Speed Faster Slower
Security Risky if key is exposed More secure for key exchange
Key Distribution Requires secure method Public key can be openly shared
Scalability Poor for large networks Scales well
Use Cases File encryption, VPNs SSL/TLS, Digital signatures, PGP

Hybrid Use (Best of Both)

 Many systems (e.g., HTTPS, PGP, TLS) use both:


o Asymmetric to exchange a symmetric key securely.
o Symmetric for fast data encryption.

Steganography in Cryptography:

Definition:

Steganography is the practice of hiding a secret message within another ordinary, non-
secret file or message, in such a way that no one suspects the existence of the hidden
message.

While cryptography scrambles the message (makes it unreadable), steganography hides its
very existence.
Main Objective:

 To conceal the communication by hiding information in digital media, like images,


audio, video, or text files.
 Even if someone intercepts the file, they won’t know a message is hidden inside.

Common Steganography Techniques:

1. Image Steganography

 Hide data in the least significant bits (LSBs) of image pixels.


 Example: A red pixel (10011111) can be altered to (10011110) to hide a bit of secret
data — visual difference is almost undetectable.

2. Audio Steganography

 Embed secret data in audio files by modifying sound frequencies or audio LSBs.

3. Video Steganography

 Combines audio and image methods to hide data in video files.

4. Text Steganography

 Altering formatting, spacing, or using invisible characters to encode information.


 Example: Extra spaces between words may represent hidden binary data.

5. Network Steganography

 Hiding data in network protocol headers (like TCP/IP) or in unused bits in network
packets.

Difference Between Cryptography and Steganography

Feature Cryptography Steganography


Focus Scrambles message content Hides message existence
Visibility Ciphertext is visible Message is invisible
Detection Easy to detect but hard to break Hard to detect
Example “KHOOR” (Caesar cipher) Hiding a message in an image
Combined Use Can be used with steganography Can embed encrypted text for more security
Advantages of Steganography

 Keeps communication invisible to outsiders.


 Often used with cryptography for double protection.
 Effective for covert communication.

❌ Limitations

 Hidden data may be detected using steganalysis tools.


 Limited capacity (you can't hide too much data).
 May be illegal in certain contexts if used for malicious purposes.

Real-World Applications

 Digital watermarking (to protect copyrights)


 Covert communication in military or intelligence
 Secure publishing or document tracking

key range and key size:


1. Key Size

 Definition:
Key size refers to the length of the encryption key (usually measured in bits).
 Purpose:
A longer key size increases the number of possible keys, making it harder for an
attacker to break the encryption by brute force.

Example Key Sizes:

Algorithm Common Key Sizes


DES 56 bits (insecure)
AES 128, 192, 256 bits
RSA 1024, 2048, 4096 bits
ECC 256, 384, 521 bits
2. Key Range

 Definition:
The key range is the total number of possible key combinations for a given key
size.
 Formula:

vbnet
CopyEdit
Key Range = 2^n
where n = key size in bits

Example:

 For a 56-bit key:


Key Range = 2^56 ≈ 7.2 × 10^16 possible keys
 For a 128-bit key:
Key Range = 2^128 ≈ 3.4 × 10^38 possible keys (practically unbreakable with
brute force)

Why Key Size Matters

 Larger key size = more security, but also more computation.


 Small key sizes (e.g., DES 56-bit) are vulnerable to brute-force attacks.
 Modern standards recommend using:
o 128-bit or more for symmetric encryption (e.g., AES-128, AES-256)
o 2048-bit or more for RSA
o 256-bit ECC is equivalent in strength to 3072-bit RSA

Security vs Performance Tradeoff

Key Size Security Level Performance


Small Low Fast
Medium Moderate Moderate
Large High (secure) Slower (more overhead)

Key Size Alone Is Not Enough

 Strong algorithms and implementation also matter.


 Even a large key is useless if the algorithm is weak or poorly implemented.
 possible types of attacks.
Possible Types of Attacks in Cryptography:
Cryptographic systems can be targeted through various attacks designed to break encryption
or reveal information without proper authorization.

1. Passive Attacks

Goal: To observe or monitor communications without altering them.

a) Eavesdropping (Interception)

 Attacker listens to communication to gather information.


 Example: Capturing usernames/passwords during transmission.

b) Traffic Analysis

 Attacker studies the pattern, size, and timing of messages to infer sensitive
information.

Defense: Use of encryption and data padding.

2. Active Attacks

Goal: To modify, insert, or delete data.

a) Masquerade Attack

 Attacker pretends to be someone else (e.g., a legitimate user).

b) Replay Attack

 Valid data is captured and resent to trick the system (e.g., reusing login tokens).

c) Modification Attack

 Altering data during transmission.

d) Denial of Service (DoS)

 Flooding a system with requests to make it unavailable to legitimate users.

Defense: Authentication, timestamps, firewalls, rate limiting.


3. Cryptanalytic Attacks

Goal: Break the encryption algorithm or discover the key.

a) Brute Force Attack

 Trying all possible keys until the correct one is found.


Use large key sizes to defend.

b) Known Plaintext Attack (KPA)

 Attacker knows some plaintext-ciphertext pairs and tries to find the key.

c) Chosen Plaintext Attack (CPA)

 Attacker can choose plaintexts to encrypt and studies resulting ciphertexts.

d) Ciphertext-Only Attack

 Attacker has only ciphertexts and tries to deduce the plaintext or key.

e) Differential Cryptanalysis

 Examines differences in ciphertexts resulting from slight changes in plaintext.

f) Linear Cryptanalysis

 Uses linear approximations to describe the behavior of the block cipher.

4. Side-Channel Attacks

Exploit implementation flaws rather than the algorithm itself.

Examples:

 Timing attacks: Measure time taken for computations.


 Power analysis: Observe power consumption patterns.
 Electromagnetic leaks: Monitor radiation from hardware.

You might also like