Crypt 2
Crypt 2
Unit – III
Objectives:
To introduce the symmetric cipher model
To know different encryption algorithms and modes of operations.
Basics of Cryptography
Right-hand portion of Figure shows the way in which the 56-bit key is
used.
o Initially, the key is passed through a permutation function.
o Then, for each of the sixteen rounds, a subkey (Ki ) is produced by
the combination of a left circular shift and a permutation.
o The permutation function is the same for each round, but a different
subkey is produced because of the repeated shifts of the key bits.
The level of security provided by DES fall into two areas: key size and the nature
of the algorithm.
The Use of 56-Bit Keys
o With a key length of 56 bits, there are 256 possible keys, which is
approximately 7.2*1016 keys.
o A brute-force attack is impractical on DES.
o On average, half the key space has to be searched, a single machine
performing one DES encryption per microsecond would take more
than a thousand years to break the cipher.
The Nature of the DES Algorithm
o The focus of concern has been on the eight substitution tables, or
S-boxes, that are used in each iteration.
o A number of regularities and unexpected behaviors of the S-boxes
have been discovered. Despite this, no one has so far succeeded in
discovering the supposed fatal weaknesses in the S-boxes.
Timing Attacks
o A timing attack exploits the fact that an encryption or decryption
algorithm often takes slightly different amounts of time on different
inputs.
o DES appears to be fairly resistant to a successful timing attack.
DES Design Criteria: focus is on the design of the S-boxes and on the P function that
takes the output of the S-boxes.
The criteria for the S-boxes are as follows
1. No output bit of any S-box should be too close a linear function of the input
bits.
2. Each row of an S-box should include all 16 possible output bit combinations.
3. If two inputs to an S-box differ in exactly one bit, the outputs must differ in at
least two bits
4. If two inputs to an S-box differ in the two middle bits exactly, the outputs
must differ in at least two bits.
5. If two inputs to an S-box differ in their first two bits and are identical in their
last two bits, the two outputs must not be the same.
6. For any nonzero 6-bit difference between inputs, no more than eight of the
32 pairs of inputs exhibiting that difference may result in the same output
difference.
7. This is a criterion similar to the previous one, but for the case of three S-
boxes.
The criteria for the permutation P are as follows.
1. The four output bits from each S-box at round are distributed so that two of
them affect “middle bits” of round (i + 1) and the other two affect end bits.
2. The four output bits from each S-box affect six different S-boxes on the next
round, and no two affect the same S-box.
3. For two S-boxes j, k, if an output bit from Sj affects a middle bit of Sk on the
next round, then an output bit from Sk cannot affect a middle bit of Sj. This
implies that, for j=k, an output bit from Sj must not affect a middle bit of Sj.
the input to the encryption algorithm is the XOR of the current plaintext
block and the preceding ciphertext block.
the same key is used for each block
To produce the first block of ciphertext, an initialization vector (IV) is
XORed with the first block of plaintext
3.8 AES
Advanced Encryption Standard (AES) was published by the National
Institute of Standards and Technology (NIST).
AES is a block cipher intended to replace DES for commercial applications.
It uses a 128-bit block size and a key size of 128, 192, or 256 bits.
AES does not use a Feistel structure. Instead, each full round consists of
four separate functions: byte substitution, permutation, arithmetic
operations over a finite field, and XOR with a key.
plaintext block is of size 128 bits, or 16 bytes
The key length can be 16, 24, or 32 bytes (128, 192, or 256 bits)
The algorithm is referred to as AES-128, AES-192, or AES-256, depending
on the key length.
The cipher consists of N rounds, where the number of rounds depends on
the key length: 10 rounds for a 16-byte key, 12 rounds for a 24-byte key,
and 14 rounds for a 32-byte key.
The first rounds consist of four distinct transformation functions:
SubBytes, ShiftRows, MixColumns, and AddRoundKey.
The final round contains only three transformations, and there is a initial
single transformation (AddRoundKey) before the first round, which can be
considered Round 0.
Four different stages are used, one of permutation and three of
substitution
o Substitute Bytes: Uses an S-box to perform a byte-by-byte
substitution of the block
o Shift Rows: A simple permutation
o Mix Columns: A substitution that makes use of arithmetic over
GF(28)
o Add Round Key: A simple bitwise XOR of the current block with a
portion of the expanded key
o
Add Round Key
o the 128 bits of State are bitwise XORed with the 128 bits of the
round key.
o the operation is viewed as a column wise operation between the 4
bytes of a State column and one word of the round key
o The following is an example of AddRoundKey:
o
o The first matrix is State, and the second matrix is the round key.
o The inverse add round key transformation is identical to the forward
add round key transformation, because the XOR operation is its own
inverse.
AES Key Expansion
Department Of Information Technology IT Page 20
Engineering Mathematics IV UNIT-3
o takes 128-bit (16-byte) key and expands into array of 44/52/60 32-
bit words
o start by copying key into first 4 words
o then loop creating words that depend on values in previous & 4
places back
o in 3 of 4 cases just XOR these together
o every 4th has S-box + rotate + XOR constant of previous before XOR
together
o designed to resist known attacks
AES Decryption
o AES decryption is not identical to encryption since steps done in
reverse
o but can define an equivalent inverse cipher with steps as for
encryption
but using inverses of each step
with a different key schedule
o -works since result is unchanged when
swap byte substitution & shift rows
swap mix columns & add (tweaked) round key
a. Steganography b. cryptography
20. In which technique the messages are converted to unreadable
format?
a. Steganography b. cryptography
21. What is the output of Permuted Choice 2 in round function of DES
a. 48 bit key b. 56 bit key c. 64bit key
22. How many S-boxes are present in DES? __________
23. If an AES algorithm takes an input of 128bits plain text and 128 bit
key, how many rounds need to be present in the algorithm? ________
a. 10 rounds b. 12 rounds c. 14 rounds
24. Different names of AES (like AES-128, AES-192, AES-256) are based
on ________
25. The input size of plaintext in Electronic codebook mode is ___________
a. 64bit b. 56 bit c. 128bit d. 192 bit
26. Each block of plaintext in COUNTER (CTR) mode is _______ with an
encrypted counter
a. AND b. OR c. XOR d. NAND
B. Descriptive Questions
1. What are the five ingredients to a symmetric encryption scheme?
Explain with a diagram.
2. Define stream cipher and block cipher?
3. Give the general depiction of DES encryption algorithm
4. State the round function of DES algorithm
5. Describe the block cipher design principles
6. State the encryption and decryption process of AES algorithm
7. Define the electronic code book mode of operation
8. Recall the counter mode in block cipher mode of operations
9. Differentiate block cipher and stream cipher mode of operations
10. Identify the strengths of DES Algorithm.
11. Distinguish Cipher feedback mode and output Feedback mode
12. Describe the purpose of a counter in COUNTER (CTR) mode.
C. GATE oriented
I Objective Questions
1. If both sender and receiver uses a single key for both encryption and
decryption it is known as ________________
2. Symmetric encryption algorithm is also called as ________________
3. If sender and receiver uses different keys for encryption and decryption, the
algorithm is known as ______________
4. Asymmetric encryption algorithm is also known as _____________
II Descriptive Questions
1. Differentiate the symmetric and asymmetric encryption process.