Block Ciphers
Block Ciphers
Block Ciphers
A symmetric classification
Stream cipher Block cipher
100110110100010111010010
1 1 0 0 0
100110110100010111010010
100110 110100 010111
1...
1..
1.
0.
110010
011101
010010
110010011101010010001001
1100100111010100100010011
Stream cipher
A stream cipher is a method of encrypting text (to produce ciphertext) in which a cryptographic key and algorithm are applied to each binary digit in a data stream, one bit at a time. This method is not much used in modern cryptography. A key stream generator produces a stream of keys which are then used with plaintext to form the cipher text. Example: one time pad, affine cipher.
Keystream generator
key
keystream
K1,K2,,Kn
+
plaintext bits P1,P2,,Pn
Advantage: -Less implementation cost. - stream ciphers work on only a few bits at a time thats why they have relatively low memory requirements - It is suitable for H/W implementation. Disadvantage: - Stream ciphers are more difficult to implement correctly. - stream ciphers do not provide integrity protection or authentication. - As the stream ciphers are individually encrypted with not connection to other chunks of data, error correction are more difficult.
Block cipher
A block cipher is a method of encrypting text (to produce ciphertext) in which a cryptographic key and algorithm are applied to a block of data at once as a group rather than to one bit at a time. Example : DES, Hill Cipher.
block of ciphertext
Advantage : - It is used for S/W implementation. - More suitable In trading applications. - In the real world block ciphers seem to be more general - It is some what faster than stream cipher each time n characters executed. Disadvantage: - Its required more memory space. - required large number of coding for implementation.
5
1 2 3
S-box: The S-box can have different number of inputs and outputs. In other words, the input to an S-box could be an n-bit word, but the output can be an m bit word where n and m are not necessarily same. S box may be keyed or keyless . 0 1 2 3 4 5 6 7 8 9 A B C D E F E 4 D 1 2 F B 8 3 A 6 C 5 9 0 7
Other operations: Exclusive OR Compliment Inverse Circular Shift Swap Split and Combine
Confusion
Hide the relationship between the ciphertext and key as difficult as possible If a single bit in a key is changed, most or all bits in the ciphertext also be changed Control attempts to discover the key Can be achieved by using a complex, non-linear, substitution operation (S-box)
01 10
11
10 00
01
01
10 11
10
00 01
Feistel Cipher
The input to a feistel structure is a plaintext box of n bits and a key K. The input key is broken down into two halves, L0 and R0 . The two halves of the data pass through r rounds of processing and the combined to produce the ciphertext block. Each round i has input Li-1 and Ri-1 , derived from previous round, as well as a sub key k derived from the over all key K. In general, subkey ki is different from K and from each other. In this cipher, a substitution is performed via the round function F and permutation is performed that interchanges the two halves of data.
SPN Algorithm
Encryption proceeds in N stages. Stage Encryption proceeds in N stages. Stage j encryption for j = 1 to N 1:
X-or with subkey Kj break into l-bit substrings and substitute each substring using S Permute the bits using P
Stage N encryption:
X-or with subkey KN break into l-bit substrings and substitute each substring using S X-or with KN+1
0 1 2 3 4 5 6 7 8 9 A B C D E F E 4 D 1 2 F B 8 3 A 6 C 5 9 0 7
P :
1 2 3 4
5 6 7
9 10 11 12
13 14 15 16 4 8 12 16
1 5 9 13 2 6 10 14 3 7 11 15
K = 0011 1010 1001 0100 1101 0110 0011 1111 Round keys are as follow: K1= 0011 1010 1001 0100 K2= 1010 1001 0100 1101 K3= 1001 0100 1101 0110 K4= 0100 1101 0110 0011 K5= 1101 0110 0011 1111
Plain text x = 0010 0110 1011 0111 Encryption of x proceeds as follows: w0 = 0010 0110 1011 0111 K1 = 0011 1010 1001 0100 u1 = 0001 1100 0010 0011 v1 = 0100 0101 1101 0001 w1 = 0010 1110 0000 0111
w1 = K2 = u2 = v2 = w2 =
Advantage of SPN
Design is simple for hardware as well as software Software implementation S-box is implemented in the form of look-up table Less development cost. Less computational cost.
Thank you