0% found this document useful (0 votes)
7 views14 pages

Ins 4

The document provides an overview of various encryption algorithms including DES, AES, RSA, and Diffie-Hellman, detailing their structures, strengths, and weaknesses. It also covers the concept of Man-in-the-Middle attacks and hash functions, explaining their properties and applications. Additionally, it highlights the security vulnerabilities of MD5 and the evolution of secure hash algorithms like SHA.

Uploaded by

adityapatil12564
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)
7 views14 pages

Ins 4

The document provides an overview of various encryption algorithms including DES, AES, RSA, and Diffie-Hellman, detailing their structures, strengths, and weaknesses. It also covers the concept of Man-in-the-Middle attacks and hash functions, explaining their properties and applications. Additionally, it highlights the security vulnerabilities of MD5 and the evolution of secure hash algorithms like SHA.

Uploaded by

adityapatil12564
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/ 14

Data Encryption Standard (DES) Algorithm

DES (Data Encryption Standard) is a symmetric-key block cipher that encrypts data in 64-bit
blocks using a 56-bit key. It was developed in the 1970s by IBM and later adopted as a federal
standard by the U.S. National Institute of Standards and Technology (NIST).

1. Overview
 Block Size: 64-bit
 Key Size: 56-bit (actually 64-bit, but 8 bits are used for parity)
 Rounds: 16
 Structure: Feistel Network
 Mode: Symmetric encryption (same key for encryption & decryption)

2. How DES Works


a) Key Generation

 The original 64-bit key is reduced to 56 bits (by removing parity bits).
 Sixteen 48-bit subkeys are generated using a key schedule.

b) Initial Permutation (IP)

 The 64-bit plaintext block undergoes an initial permutation.

c) Feistel Rounds (16 Rounds)

Each round consists of:

1. Splitting the 64-bit data into two halves (Left (L) and Right (R)).
2. Expansion (E-Box): Expanding the 32-bit right half to 48 bits.
3. Key Mixing: XORing the expanded right half with a 48-bit subkey.
4. Substitution (S-Box): Using S-boxes to reduce 48-bit data to 32-bit.
5. Permutation (P-Box): Rearranging the bits.
6. Swapping: The new right half becomes the next round's left half.

d) Final Permutation (FP)

 The data undergoes a final permutation, producing the encrypted output.

3. Strengths of DES
 Simple and fast encryption.
 Was widely used in financial and government sectors.
4. Weaknesses of DES
 Short Key Length (56-bit): Vulnerable to brute-force attacks.
 Susceptibility to Differential & Linear Cryptanalysis

Advanced Encryption Standard (AES) Algorithm

AES (Advanced Encryption Standard) is a symmetric key encryption algorithm used for secure
data encryption and decryption. It was established by the U.S. National Institute of Standards and
Technology (NIST) in 2001 and is widely used in applications requiring strong security.

Key Features of AES

1. Symmetric Encryption: Uses the same key for encryption and decryption.
2. Block Cipher: Operates on fixed-size data blocks of 128 bits.
3. Key Lengths: Supports three key sizes:
o AES-128 (128-bit key, 10 rounds)
o AES-192 (192-bit key, 12 rounds)
o AES-256 (256-bit key, 14 rounds)
4. High Security: Resistant to brute-force and other cryptographic attacks.
5. Fast Performance: Efficient for both hardware and software implementations.

AES Algorithm Process

AES follows a series of transformation steps to encrypt and decrypt data. The encryption process
consists of:

1. Key Expansion: Generates multiple round keys from the initial key.
2. Initial Round:
o AddRoundKey: XOR the input with the first round key.
3. Main Rounds (Repeated 9, 11, or 13 times based on key size):
o SubBytes: Substitute bytes using an S-box.
o ShiftRows: Shift rows of the matrix to the left.
o MixColumns: Mix data across columns for diffusion.
o AddRoundKey: XOR the state with a round key.
4. Final Round:
o SubBytes
o ShiftRows
o AddRoundKey (without MixColumns)

Decryption follows the reverse process using Inverse SubBytes, Inverse ShiftRows, and
Inverse MixColumns.

Applications of AES
 Secure Communication (HTTPS, TLS, VPNs)
 Data Protection (File encryption, disk encryption)
 Wireless Security (Wi-Fi WPA2/WPA3)
 Cryptographic Protocols (SSL/TLS, PGP, SSH)

AES is the gold standard for encryption and is widely used by governments, organizations, and
individuals for securing sensitive data.

RSA (Rivest-Shamir-Adleman) Algorithm

RSA is a public-key cryptographic algorithm used for secure data transmission and
encryption. It is widely used in secure communications, such as SSL/TLS, digital signatures, and
data encryption.

1. Overview
 Type: Asymmetric-key cryptography (Public Key Encryption)
 Keys: Public Key (for encryption) & Private Key (for decryption)
 Security Basis: Depends on the difficulty of factoring large prime numbers.

2. How RSA Works


a) Key Generation

1. Select two large prime numbers ppp and qqq.


2. Compute n=p×qn = p \times qn=p×q (This forms part of the public key).
3. Calculate Euler's totient function: ϕ(n)=(p−1)×(q−1)\phi(n) = (p - 1) \times (q -
1)ϕ(n)=(p−1)×(q−1)
4. Choose a public exponent eee such that:
o 1<e<ϕ(n)1 < e < \phi(n)1<e<ϕ(n)
o eee is co-prime with ϕ(n)\phi(n)ϕ(n) (i.e., gcd⁡(e,ϕ(n))=1\gcd(e, \phi(n)) =
1gcd(e,ϕ(n))=1).
o Common choice: e=65537e = 65537e=65537.
5. Compute the private exponent ddd: d=e−1mod ϕ(n)d = e^{-1} \mod
\phi(n)d=e−1modϕ(n) (This means ddd is the modular multiplicative inverse of eee
modulo ϕ(n)\phi(n)ϕ(n)).

b) Encryption Process

1. Convert the plaintext message MMM into a numerical value.


2. Compute the ciphertext CCC using the public key: C=Memod nC = M^e \mod
nC=Memodn

c) Decryption Process
1. Compute the plaintext MMM using the private key: M=Cdmod nM = C^d \mod
nM=Cdmodn

3. Strengths of RSA
✔ Highly Secure (when large key sizes are used)
✔ Used in Digital Signatures & Secure Key Exchange
✔ No Need to Share a Secret Key (solves key distribution problems)

4. Weaknesses of RSA
❌ Slow Compared to Symmetric Algorithms (like AES)
❌ Vulnerable to Factorization Attacks (if small key sizes are used)
❌ Requires Large Key Sizes (2048-bit or higher recommended for security)

Diffie-Hellman Key Exchange Algorithm

The Diffie-Hellman key exchange (DHKE) is a cryptographic method that allows two parties to
establish a shared secret over an insecure channel without transmitting the secret itself. It is
widely used in secure communication protocols such as SSL/TLS, SSH, and VPNs.

1. Overview
 Type: Asymmetric key exchange algorithm
 Purpose: Securely exchange a cryptographic key over an insecure channel
 Security Basis: Relies on the difficulty of computing the Discrete Logarithm Problem
(DLP)

2. How Diffie-Hellman Works


1. Choose a Large Prime Number ppp and a Generator ggg:
o ppp is a large prime number (publicly known).
o ggg (a primitive root modulo ppp) is also publicly known.
2. Key Exchange Between Two Parties (Alice & Bob):
o Alice chooses a private key aaa and computes her public key: A=gamod pA =
g^a \mod pA=gamodp
o Bob chooses a private key bbb and computes his public key: B=gbmod pB =
g^b \mod pB=gbmodp
o Both A and B are shared publicly.
3. Compute the Shared Secret:
o Alice computes: S=Bamod pS = B^a \mod pS=Bamodp
o Bob computes: S=Abmod pS = A^b \mod pS=Abmodp
o Since B=gbmod pB = g^b \mod pB=gbmodp and A=gamod pA = g^a \mod
pA=gamodp, the shared secret is: S=gabmod pS = g^{ab} \mod pS=gabmodp
o Both Alice and Bob now have the same shared secret SSS, which can be used as
a cryptographic key.

4. Strengths of Diffie-Hellman
✔ Secure key exchange over an insecure channel
✔ Used in secure communication protocols (TLS, SSH, IPsec, etc.)
✔ No prior secret key exchange required

5. Weaknesses of Diffie-Hellman
❌ Vulnerable to Man-in-the-Middle (MITM) Attacks (if authentication is not used)
❌ Does not provide encryption (only key exchange)
❌ Security relies on the size of ppp (larger primes increase security)

Man-in-the-Middle (MITM) Attack


A Man-in-the-Middle (MITM) attack is a type of cyberattack where an attacker secretly
intercepts and alters communication between two parties without their knowledge. The attacker
acts as a bridge and can eavesdrop, modify, or inject malicious content into the conversation.

1. How a MITM Attack Works


Scenario: Intercepting Communication Between Alice & Bob

1. Alice wants to communicate securely with Bob.


2. An attacker (Eve) intercepts the connection.
3. Eve pretends to be Bob to Alice and pretends to be Alice to Bob.
4. Eve decrypts, modifies, or steals messages before forwarding them.
5. Alice and Bob believe they are talking directly, but Eve is in control.

2. Types of MITM Attacks


a) Eavesdropping (Passive Attack)

 The attacker silently listens to the communication without altering it.

b) Session Hijacking

 The attacker steals a session token (like a login session) and takes control of a user's
session.

c) HTTPS Spoofing
 The attacker tricks users into believing they are on a secure HTTPS website when they
are actually on a fake site.

d) Wi-Fi Eavesdropping

 The attacker sets up a fake Wi-Fi hotspot to intercept user data.

e) DNS Spoofing

 Redirects users to a fake website by modifying DNS responses.

f) SSL Stripping

 Downgrades an HTTPS connection to HTTP, making it unencrypted and vulnerable.

3. Example: MITM Attack on Diffie-Hellman Key Exchange


 Instead of Alice and Bob securely exchanging a key, the attacker (Eve) creates two
separate keys:
o One with Alice
o One with Bob
 Eve can decrypt and re-encrypt messages, making Alice and Bob believe they have
secure communication when Eve is in the middle.

4. How to Prevent MITM Attacks


✔ Use Strong Encryption (TLS/SSL)
✔ Implement Digital Signatures & Certificates (PKI, HTTPS, SSL/TLS Certificates)
✔ Enable Multi-Factor Authentication (MFA)
✔ Avoid Public Wi-Fi Networks (Use VPNs)
✔ Verify SSL Certificates (Look for HTTPS & lock symbol in the browser)
✔ Use End-to-End Encryption (E2EE) (e.g., Signal, WhatsApp)

Hash Function
A hash function is a mathematical function that takes an input (data) and produces a fixed-size
output (hash value or digest). It is commonly used in cryptography, data integrity, and password
storage.

1. Properties of a Good Hash Function


A secure hash function must satisfy these properties:
1. Deterministic: The same input always produces the same output.
2. Fast Computation: Should compute hash values quickly.
3. Pre-image Resistance: It should be difficult to reverse-engineer the original input from
the hash.
4. Small Change, Big Difference (Avalanche Effect): A tiny change in input should
produce a completely different hash.
5. Collision Resistance: No two different inputs should generate the same hash value.
6. Resistance to Second Pre-image Attacks: If given a hash value h(x)h(x)h(x), it should
be difficult to find another yyy such that h(y)=h(x)h(y) = h(x)h(y)=h(x).

2. Common Cryptographic Hash Functions


Hash Algorithm Hash Size Usage
MD5 128-bit Weak (vulnerable to collisions)
SHA-1 160-bit Deprecated (not secure)
SHA-256 256-bit Secure, widely used (Bitcoin, SSL/TLS)
SHA-3 Variable Latest NIST standard
BLAKE2 Variable Faster alternative to SHA-3

4. Applications of Hash Functions


✔ Password Storage (e.g., storing hashed passwords instead of plain text)
✔ Data Integrity Verification (e.g., verifying file integrity with checksums)
✔ Digital Signatures (e.g., ensuring message authenticity)
✔ Blockchain & Cryptocurrencies (e.g., Bitcoin uses SHA-256)
✔ Data Indexing (e.g., hash tables in databases)

MD5 (Message-Digest Algorithm 5)


MD5 is a cryptographic hash function that produces a 128-bit hash value (32 hexadecimal
characters). It was designed by Ronald Rivest in 1991 and was widely used for checksums,
digital signatures, and password hashing. However, it is now considered insecure due to
vulnerabilities.

1. Characteristics of MD5
 Input Size: Any length
 Output Size: 128-bit (32 hex characters)
 Fast Computation: Efficient but weak against modern attacks
 Not Collision-Resistant: Can generate the same hash for different inputs

2. How MD5 Works


1. Padding: The input message is padded so its length is a multiple of 512 bits.
2. Initialize MD5 Buffers: Four 32-bit buffers (A, B, C, D) are initialized with fixed
values.
3. Processing in 512-bit Blocks:
o The input is divided into 512-bit blocks.
o Each block is processed through 64 rounds of bitwise operations.
o Uses modular addition, bitwise shifts, and logical operations (XOR, AND, OR).
4. Final Output: The final 128-bit hash is generated.

3. MD5 Example
Hashing "Hello"
mathematica
CopyEdit
Input: "Hello"
MD5 Hash: 8b1a9953c4611296a827abf8c47804d7

Changing even a single letter (e.g., "hello" instead of "Hello") produces a completely different
hash.

4. Security Weaknesses
❌ Collision Vulnerability: Two different inputs can produce the same hash.
❌ Not Suitable for Password Storage: Can be cracked using rainbow tables and brute-force
attacks.
❌ Not Secure for Digital Signatures: Vulnerable to hash collisions (e.g., forging documents).

🔴 MD5 is Deprecated

Modern cryptographic applications use SHA-256 or SHA-3 instead.

5. Applications (Legacy Use)


✔ File Integrity Checks (Checksums)
✔ Non-Critical Data Hashing
✔ Legacy Systems (where security is not a concern)

SHA (Secure Hash Algorithm)


SHA (Secure Hash Algorithm) is a family of cryptographic hash functions designed to ensure
data integrity and security. It was developed by the National Security Agency (NSA) and
published by NIST (National Institute of Standards and Technology).
🔹 Key Features of SHA

 Converts an input into a fixed-size hash value.


 Provides data integrity (detects modifications).
 Uses one-way hashing (irreversible).
 Resistant to collision attacks (depending on the SHA version).

1. Types of SHA Algorithms


Algorithm Hash Size Security Status
SHA-1 160-bit Weak (collisions found) Deprecated ❌
SHA-224 224-bit Stronger than SHA-1 Secure ✅
SHA-256 256-bit Widely used (SSL, Bitcoin) Secure ✅
SHA-384 384-bit More secure than SHA-256 Secure ✅
SHA-512 512-bit Strongest in the SHA-2 family Secure ✅
SHA-3 Variable (224, 256, 384, 512) Latest NIST standard (2015) Highly Secure ✅

2. How SHA Works


1. Padding: The input is padded to fit into fixed-size blocks.
2. Block Processing: Each block undergoes multiple rounds of bitwise operations, modular
additions, and logical functions.
3. Compression: The final hash value is computed after all blocks are processed.

3. Example: SHA-256 Hash of "Hello"


mathematica
CopyEdit
Input: "Hello"
SHA-256 Hash:
185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969

Changing one letter (e.g., "hello" instead of "Hello") completely changes the hash due to the
avalanche effect.

4. Applications of SHA
✔ Password Hashing (SHA-256, SHA-512)
✔ Digital Signatures (SHA-256 in Bitcoin, SSL/TLS)
✔ Data Integrity Verification (File checksums)
✔ Blockchain & Cryptocurrencies (SHA-256 in Bitcoin mining)
5. SHA vs. MD5
Feature SHA-256 MD5
Hash Length 256-bit 128-bit
Security Highly secure Weak (collision attacks)
Speed Slower than MD5 Faster but insecure
Usage Cryptography, Digital Signatures Checksums, Legacy Systems

Digital Signature: Introduction & Working

1. Introduction to Digital Signature


A digital signature is a cryptographic technique used to ensure the authenticity, integrity,
and non-repudiation of digital messages or documents. It is the digital equivalent of a
handwritten signature or a stamped seal, but it is much more secure.

✅Key Purposes of Digital Signatures:

 Authentication: Confirms the identity of the sender.


 Integrity: Ensures the message has not been altered.
 Non-Repudiation: Prevents the sender from denying they signed the document.

🔹 Based on Public Key Cryptography (Asymmetric Encryption)


A digital signature uses a pair of keys:

 Private Key (used to sign)


 Public Key (used to verify)

2. How Digital Signatures Work


Step 1: Message Hashing

 The sender's message/document is hashed using a cryptographic hash function (SHA-256, SHA-
3, etc.).
 The hash function ensures that even a small change in the message creates a completely
different hash.
 Example:

mathematica
CopyEdit
Message: "Hello"
SHA-256 Hash:
185f8db32271fe25f561a6fc938b2e264306ec304eda518007d1764826381969
Step 2: Signing the Hash

 The sender uses their private key to encrypt the hash using an encryption algorithm like RSA,
DSA, or ECDSA.
 This encrypted hash is the digital signature.

Step 3: Sending the Message

 The original message and the digital signature are sent to the receiver.

Step 4: Signature Verification

 The receiver uses the sender's public key to decrypt the digital signature and retrieve the
original hash.
 The receiver also hashes the received message using the same hash function.
 If both hashes match, the signature is valid (message is authentic and unaltered).
 If they do not match, the message has been tampered with or is not from the claimed sender.

3. Example of Digital Signature Process


Step Action

Sender Hashes the message using SHA-256

Sender Encrypts the hash with their private key (RSA, DSA, ECDSA)

Sender Sends the message + digital signature to the receiver

Receiver Hashes the received message using the same hash function

Receiver Decrypts the digital signature using the sender’s public key

Receiver Compares the two hashes

Result If they match, the message is authentic. Otherwise, it is tampered.

4. Algorithms Used for Digital Signatures


Algorithm Key Size Security Level Usage

RSA (Rivest-Shamir-Adleman) 2048- Strong Commonly used in SSL/TLS, Email


Algorithm Key Size Security Level Usage

bit+ Signing

DSA (Digital Signature 1024-


Moderate U.S. Government Standard
Algorithm) bit+

Stronger &
ECDSA (Elliptic Curve DSA) 256-bit+ Used in Bitcoin, Ethereum, TLS
Faster

5. Applications of Digital Signatures


✔ Email Security (Signing emails to prevent spoofing)
✔ SSL/TLS Certificates (Ensuring website authenticity)
✔ Software Distribution (Verifying software authenticity)
✔ Blockchain & Cryptocurrencies (Bitcoin, Ethereum transactions)
✔ Electronic Contracts & Legal Documents (E-signatures)

6. Advantages & Disadvantages of Digital Signatures


✅ Advantages

 High Security (Prevents forgery & tampering)


 Legal Validity (Used in e-Governance, online contracts)
 Fast & Efficient (Automates document verification)

❌ Disadvantages

 Private Key Protection (Loss of private key = loss of security)


 Computational Overhead (Slower than simple hashing)
 Dependent on Cryptographic Strength (Weaker algorithms can be broken)

Threats to Mobile Phones & Security Measures

1. Introduction
Mobile phones store sensitive data, including personal information, banking details, and business
communications. They are vulnerable to cyber threats, which can lead to data breaches, identity
theft, and financial losses.

2. Common Mobile Phone Threats


1. Malware & Viruses

 Malicious software (spyware, ransomware, trojans) can steal data, track activities, or lock
devices.
 Example: Joker malware (steals SMS and contacts).

🔹 Security Measures:
✔ Install apps only from official stores (Google Play, Apple App Store).
✔ Use antivirus software.
✔ Avoid clicking suspicious links in messages or emails.

2. Phishing Attacks

 Hackers trick users into revealing sensitive information via fake emails, messages, or websites.
 Example: Fake banking login pages.

🔹 Security Measures:
✔ Verify email and website URLs before entering login details.
✔ Never share OTPs or passwords.
✔ Enable spam filters and email authentication.

3. Man-in-the-Middle (MITM) Attacks

 Attackers intercept data between your phone and a server over public Wi-Fi.
 Example: Hackers stealing login credentials via fake Wi-Fi networks.

🔹 Security Measures:
✔ Avoid public Wi-Fi or use a VPN.
✔ Use websites with HTTPS encryption.
✔ Enable two-factor authentication (2FA) for important accounts.

4. SIM Swapping

 Attackers convince mobile carriers to transfer a victim’s phone number to a new SIM card,
gaining access to SMS-based OTPs.

🔹 Security Measures:
✔ Use app-based authentication (Google Authenticator, Authy) instead of SMS OTPs.
✔ Set a PIN lock for your SIM card.
✔ Contact your carrier for extra security measures.

5. Data Leakage via Apps


 Some apps request excessive permissions and collect private data (location, contacts,
messages).

🔹 Security Measures:
✔ Check app permissions before installing.
✔ Disable background data access for untrusted apps.
✔ Use privacy-focused apps.

6. Physical Theft & Unauthorized Access

 Lost or stolen devices can expose personal and corporate data.

🔹 Security Measures:
✔ Enable screen lock (PIN, fingerprint, or Face ID).
✔ Enable remote wipe (Find My iPhone, Google Find My Device).
✔ Encrypt sensitive data stored on the phone.

7. Bluetooth & NFC Exploits

 Attackers can steal data or install malware through open Bluetooth/NFC connections.

🔹 Security Measures:
✔ Keep Bluetooth and NFC disabled when not in use.
✔ Set devices to "Not Discoverable" mode.

8. Outdated Software & OS Vulnerabilities

 Hackers exploit unpatched security flaws in outdated apps or OS versions.

🔹 Security Measures:
✔ Keep the OS and apps updated.
✔ Enable automatic updates.
✔ Use trusted brands that provide long-term security updates.

3. Best Practices for Mobile Security


✔ Use Strong Passwords: Avoid common passwords like "123456" or "password".
✔ Enable Multi-Factor Authentication (MFA): Adds an extra security layer.
✔ Backup Data Regularly: To protect against loss or ransomware attacks.
✔ Be Wary of Unknown Links & Messages: Avoid clicking on suspicious messages.
✔ Use Secure Cloud Services: Encrypt sensitive files stored online.

You might also like