Unit 2 Data Encryption & Compression (1)
Unit 2 Data Encryption & Compression (1)
Definition: A single secret key is used for both encryption and decryption.
Key Features:
o Faster than asymmetric cryptography.
o Requires secure key distribution.
Common Algorithms: DES, AES, IDEA.
Example: If Alice encrypts a message using a secret key KKK, Bob needs the same
KKK to decrypt it.
The Data Encryption Standard (DES) is a symmetric key block cipher encryption
algorithm that encrypts data in fixed-size blocks (64 bits) using a 56-bit key. Developed in
the 1970s, DES operates on the principles of substitution and permutation, transforming
plaintext into ciphertext to ensure data confidentiality.
Example
Input:
Process:
Output:
Limitation of DES
1. Key Length: The 56-bit key is vulnerable to brute-force attacks, making DES
insecure for modern use.
2. Superseded by AES: DES has been replaced by the Advanced Encryption Standard
(AES), which offers better security and efficiency.
RSA is a widely used asymmetric encryption algorithm based on the principles of number
theory. It relies on a pair of keys: a public key for encryption and a private key for
decryption. RSA provides robust security by leveraging the computational difficulty of
factoring large prime numbers.
Applications of RSA
Limitations of RSA
Hybrid Cryptography:
o Combines the efficiency of symmetric encryption with the security of
asymmetric encryption.
o Example: SSL/TLS protocols use RSA to exchange symmetric keys and AES
for actual data encryption.
The International Data Encryption Algorithm (IDEA) is a symmetric key block cipher
used for secure data encryption. It was designed in 1991 by James Massey and Xuejia Lai as
an improvement over the Data Encryption Standard (DES). IDEA is known for its simplicity,
speed, and high level of security.
1. Input
2. Key Generation
The 128-bit key is divided into 52 subkeys, each 16 bits long, for use in the encryption
process.
3. Encryption Process
The plaintext is divided into four 16-bit sub-blocks.
In each round, the blocks are transformed using:
1. Modular Addition: Addition modulo 2162116.
2. Modular Multiplication: Multiplication modulo 216+1216+ 1.
3. Bitwise XOR: XOR operation.
The final half-round applies additional transformations to complete the encryption.
4. Decryption Process
The decryption process uses the same algorithm but applies the subkeys in reverse order,
with specific modular inverses for addition and multiplication.
Example
Scenario
1. Input:
o Plaintext: "HELLO!"
o Convert to binary or hexadecimal: Assume 48 48-bit representation in ASCII.
2. Key:
o A random 128-bit key
(e.g.,0x2BD6459F82C5B300952C49104881FF480x2BD6459F82C5B300952C49104881FF48).
3. Process:
o Divide the plaintext into 16-bit chunks.
o Use modular addition, multiplication, and XOR with subkeys to perform 8.5 rounds
of transformation.
4. Output:
o Ciphertext: Encrypted 64-bit block
(e.g., 0x3A94D63F1E538C220x3A94D63F1E538C22).
Advantages of IDEA
1. Strong Security: Resistant to many cryptographic attacks, including differential and linear
cryptanalysis.
2. Efficient: Suitable for both hardware and software implementation.
3. Compact Key Size: 128-bit key provides robust security while remaining efficient.
Limitations
1. Block Size: A 64-bit block size is smaller compared to modern standards (e.g., AES uses 128-
bit blocks).
2. Patent Restrictions: Initially patented, limiting its adoption; the patent expired in 2011.
3. Obsolescence: Less commonly used in favor of newer algorithms like AES.
Applications of IDEA
1. Pretty Good Privacy (PGP): Used for encrypting emails and files.
2. Secure File Storage: Encrypting sensitive data on disk.
3. Communication Security: Encrypting messages in secure communication systems.
Differential Cryptanalysis:
o Studies differences in input and how they affect output differences.
o Effective against Feistel ciphers like DES.
Linear Cryptanalysis:
o Approximates the behavior of the cipher using linear equations.
o Focuses on the relationship between plaintext, ciphertext, and key bits.
Both differential cryptanalysis and linear cryptanalysis are techniques for analyzing and
attacking block ciphers. They aim to discover vulnerabilities in cryptographic algorithms,
particularly substitution-permutation networks (SPNs) and Feistel ciphers, to recover secret
keys or plaintext.
1. Differential Cryptanalysis
Key Concepts
The attacker tries to predict how input differences propagate through the cipher using patterns
in the S-boxes and other transformations.
2. Linear Cryptanalysis
Key Concepts
Example
DES, FEAL DES, Serpent
Cipher
6. Digital Signature:
Digital Signature
A digital signature is a cryptographic technique that ensures the authenticity, integrity, and
non-repudiation of digital messages or documents. It functions as the electronic equivalent of
a handwritten signature or a stamped seal, but it is far more secure due to its cryptographic
foundation.
Process:
1. Generate a hash of the message.
2. Encrypt the hash using the sender’s private key.
3. Verify the signature using the sender’s public key.
Example: RSA is commonly used for digital signatures.
Key Features
Digital signatures use public key infrastructure (PKI) and operate as follows:
1. Key Generation
2. Signing Process
Message Digest: The sender applies a cryptographic hash function to the original message to
generate a fixed-size hash (digest).
Signature Creation: The sender encrypts the hash using their private key to create the digital
signature.
The sender sends both the original message and the digital signature.
3. Verification Process
The receiver decrypts the digital signature using the sender's public key to obtain the hash.
The receiver computes the hash of the original message using the same hash function.
If the two hashes match:
o The message is authentic.
o The message integrity is preserved.
Example
Scenario
Alice sends:
1. Bob decrypts the digital signature using Alice's public key to obtain the hash:
o Decrypt(Digital Signature, Public Key) →
f7bc83f430538424b13298e6aa6fb143ef4d59a149460ddde781a5f5.
2. Bob hashes the received message:
o Hash("Hello, Bob!") →
f7bc83f430538424b13298e6aa6fb143ef4d59a149460ddde781a5f5.
3. Bob compares the hashes:
o If the hashes match, the message is verified.
1. Email Security: Verifying the sender and ensuring the email's integrity.
2. Software Distribution: Ensuring software is from the original publisher and unaltered.
3. Legal Documents: Digitally signing contracts or agreements.
4. Blockchain: Validating transactions in cryptocurrencies.
Advantages
Disadvantages
Knapsack Algorithm
The Knapsack Algorithm solves this problem using techniques such as dynamic
programming, greedy approaches, or backtracking, depending on the problem type.
Problem Statement
Items:
o Item 1: Weight = 2, Value = 3
o Item 2: Weight = 3, Value = 4
o Item 3: Weight = 4, Value = 5
o Item 4: Weight = 5, Value = 6
Capacity: 5
2. Recurrence Relation:
dp[i][w]= {dp[i−1][w]
max(dp[i−1][w],value[i]+dp[i−1][w−weight[i]])
if w<weight[i]otherwise
3. Table Construction:
o Use the recurrence relation to fill the table.
o The value at dp[n][W] gives the maximum value, where nn is the number of items
and WW is the capacity.
Example Solution
Items\Weight 0 1 2 3 4 5
0 000000
1 003333
2 003447
3 003457
4 003456
Problem Statement
Items:
o Item 1: Weight = 10, Value = 60
o Item 2: Weight = 20, Value = 100
o Item 3: Weight = 30, Value = 120
Capacity: 50
Greedy Approach