Unit 2
Unit 2
Unit 2
the IBM team in early 1970 and adopted by the U.S. government as a federal
Feistel structure. The block size is 64-bit. Though, key length is 64-bit, DES has
an effective key length of 56 bits, since 8 of the 64 bits of the key are not used by
the encryption algorithm (function as check bits only). DES operates on blocks of
data, where each block consists of 64 bits. It uses a 56-bit key to encrypt and
decrypt the data. The algorithm goes through a series of permutation and
substitution operations to transform the plaintext into ciphertext using the key.
The same key is used for both encryption and decryption. However, over time,
DES became vulnerable to brute-force attacks due to its relatively short key
try all possible keys and break the encryption. As a result, DES is considered
To address the security concerns, the Advanced Encryption Standard (AES) was
developed and became the successor to DES. AES provides a higher level of
security and efficiency compared to DES. It supports key lengths of 128, 192,
algorithms.
2. Wide Adoption: DES has been widely adopted and used in various industries
applications.
Disadvantages:
1. Key Length: The primary weakness of DES is its relatively short key length of
56 bits. As computing power has increased over time, it has become vulnerable
been developed that can break DES encryption with reasonable computational
security.
3. Limited Key Space: Due to the short key length, DES has a limited key space,
meaning there are a limited number of possible keys. This limitation makes it
easier for an attacker to perform exhaustive key search attacks and decrypt the
encrypted data.
and linear cryptanalysis are examples of attacks that can reduce the effective
security of DES.
disadvantage of DES is that it has been replaced by the more secure and
efficient AES encryption algorithm. AES offers stronger security with key lengths
● Key Length: AES supports three key lengths: 128, 192, and 256 bits.
● Number of Rounds: The number of rounds varies depending on the key length:
10 rounds for 128-bit keys, 12 rounds for 192-bit keys, and 14 rounds for 256-bit
keys.
● Rijndael Structure: AES is based on the Rijndael block cipher, which was
1. AddRoundKey: The first round adds the encryption key to the plaintext block.
2. SubBytes: Each byte of the block is replaced with its corresponding entry from a
3. ShiftRows: The rows of the block are cyclically shifted to the left.
4. MixColumns: The columns of the block are mixed using matrix multiplication.
5. Repeat: Steps 2-4 are repeated for the specified number of rounds.
6. AddRoundKey: The final round adds the encryption key to the block.
A Visual Representation:
Key Points:
● S-box: The S-box is a non-linear lookup table that introduces confusion into the
encryption process.
● Number of Rounds: The increasing number of rounds for longer key lengths
enhances security.
AES is considered a highly secure algorithm and is widely used in various applications,
● Security: AES is considered one of the most secure block ciphers available. It
has undergone extensive cryptanalysis and has not been successfully attacked.
● Flexibility: AES supports multiple key lengths (128, 192, and 256 bits), allowing
● Widely Adopted: AES is the official U.S. government standard for encryption,
Disadvantages of AES:
● Potential for Side-Channel Attacks: Like any cryptographic algorithm, AES can
information.
● Key Management: Proper key management is crucial for the security of AES.
Overall, AES is a highly secure and efficient block cipher that offers significant
advantages for data encryption. However, it is essential to implement AES correctly and
OFB is a block cipher mode of operation that provides stream cipher-like properties. It
times using the block cipher. The keystream is then XORed with the plaintext to produce
the ciphertext.
Key Points:
repeatedly.
● XOR Operation: The keystream is XORed with the plaintext to produce the
ciphertext.
in the ciphertext, it will only affect a limited number of bits in the plaintext.
Advantages:
transmission errors.
Disadvantages:
Additional Considerations:
security of OFB.
● Key Length: The key length used with OFB should be sufficient to prevent
brute-force attacks.
● Alternative Modes: Other block cipher modes, such as CBC (Cipher Block
Chaining) and CTR (Counter Mode), may be more suitable for certain
potential vulnerabilities.
and message authentication into a single operation. This provides a higher level of
● Integrity: Verifies that the data has not been modified or tampered with during
transmission.
authentication processes.
Common AE Modes:
● GCM (Galois/Counter Mode): Combines AES with a Galois counter mode for
Advantages of AE:
authentication algorithms.
Disadvantages of AE:
● Complexity: AE algorithms can be more complex to implement compared to
tampering.
CBC (Cipher Block Chaining) is a block cipher mode of operation that provides a
chaining mechanism to link the encryption of each block to the previous block. This
makes CBC more resistant to certain types of attacks compared to ECB (Electronic
Codebook) mode.
random value that is combined with the first plaintext block before encryption.
2. Encryption: Each plaintext block is XORed with the ciphertext of the previous
block before being encrypted using the block cipher. The result is the ciphertext
on all previous plaintext blocks, making it more difficult for attackers to analyze
individual blocks.
Advantages of CBC:
● Efficiency: CBC is relatively efficient to implement and can be used with various
block ciphers.
Disadvantages of CBC:
attacks.
Applications:
CBC is widely used in various applications, including HTTPS, VPNs, and file encryption.
enhance security. It is a suitable choice for many applications where security and
refer to Question-2
and message authentication into a single operation. This provides a higher level of
Key Features:
● Integrity: Verifies that the data has not been modified or tampered with during
transmission.
authentication processes.
Common AE Modes:
● GCM (Galois/Counter Mode): Combines AES with a Galois counter mode for
authentication algorithms.
Disadvantages of AE:
tampering.
SHA-3 Algorithm
SHA-3 uses a sponge construction. This construction provides a more flexible and
secure design.
Sponge Construction:
1. Absorbing: The input data is divided into fixed-size blocks. Each block is XORed
with the current state of the sponge and then processed through the Keccak
function. The output of the Keccak function becomes the new state of the
sponge.
2. Squeezing: The final state of the sponge is used to generate the hash output.
This is done by repeatedly applying the Keccak function and extracting a portion
Keccak Function:
The Keccak function is the core of the SHA-3 algorithm. It is a permutation function that
operates on a 1600-bit state. The function consists of several rounds, each involving a
● Pi: A permutation operation that rearranges the elements within the state.
SHA-3 Variants:
Advantages of SHA-3:
successfully attacked.
hardware.
the algorithm.
Disadvantages of SHA-3
While SHA-3 is a highly secure and efficient hash function, it has a few potential
disadvantages:
SHA-2.
software.
● Adoption Rate: SHA-3 is a relatively new algorithm, and its adoption rate may
be slower compared to SHA-2, which has been widely used for many years.
SHA-3 is a powerful and versatile hash function that offers strong security and
Refer to question 1
RSA Algorithm
Key Generation:
Encryption:
1. Convert the plaintext: Convert the plaintext message into a numerical value
(m).
Decryption:
1. Calculate n: n = 17 * 11 = 187.
Encryption:
● Plaintext: m = 20
Decryption:
● Ciphertext: c = 106
Security:
The security of RSA relies on the difficulty of factoring the large number n. If an attacker
can factor n, they can easily calculate the private key and decrypt the ciphertext.
large prime numbers. Its security relies on the difficulty of factoring large
● Versatility: RSA can be used for both encryption and digital signatures,
Disadvantages:
for large key sizes. This can impact performance in certain applications.
● Key Management: Managing large public and private keys can be challenging,
Overall, RSA is a powerful and widely used public-key cryptosystem that offers
digital fingerprint for a given data set. This fingerprint, known as a hash value or
data.
3. Integrity Verification: If the calculated hash value matches the expected value,
it indicates that the data has not been modified or corrupted. If there is a
● Determinism: A given input will always produce the same hash value.
● File Verification: Hash functions are used to verify the integrity of files
● Data Deduplication: Hash functions can be used to identify duplicate data within
● Hash Function Selection: The choice of hash function is crucial. Algorithms like
SHA-256, SHA-3, and MD5 are commonly used, but their security properties
vary. SHA-256 and SHA-3 are generally considered more secure than MD5.
● Salt: Adding a random salt to the data before hashing can enhance security by
keys from passwords or other secrets, making it more difficult for attackers to
● Data Format: The format of the data being hashed can also affect the security
and efficiency of the hash function. For example, using a standardized format
In summary, hash functions are essential tools for ensuring data integrity. By
creating unique and sensitive hash values, they can detect and prevent
Refer to question 1
Public-Key Cryptosystems
key and a private key. The public key can be freely distributed, while the private key
Encryption:
A Visual Representation:
Key Points:
● Public Key Distribution: The public key can be freely distributed, making it
convenient for communication between parties who have not shared a secret key
beforehand.
communicate and exchange data between parties without sharing a secret key.
OFB is a block cipher mode of operation that provides stream cipher-like properties. It
times using the block cipher. The keystream is then XORed with the plaintext to produce
the ciphertext.
Key Points:
repeatedly.
● XOR Operation: The keystream is XORed with the plaintext to produce the
ciphertext.
in the ciphertext, it will only affect a limited number of bits in the plaintext.
Advantages:
transmission errors.
Disadvantages:
Additional Considerations:
security of OFB.
● Key Length: The key length used with OFB should be sufficient to prevent
brute-force attacks.
● Alternative Modes: Other block cipher modes, such as CBC (Cipher Block
Chaining) and CTR (Counter Mode), may be more suitable for certain
potential vulnerabilities.