Download presentation
Presentation is loading. Please wait.
Published byBeverly Williams Modified over 9 years ago
1
6. Practical Constructions of Symmetric-Key Primitives
CIS Cryptography 6. Practical Constructions of Symmetric-Key Primitives Based on: Jonathan Katz and Yehuda Lindell Introduction to Modern Cryptography
2
Stream ciphers A stream cipher is a pair of deterministic algorithms (Init, GetBits), where Init takes input a seed ๐ and an optional ๐ผ๐ and outputs an initial state ๐ ๐ก 0 . That is, ๐ ๐ก 0 := Init (๐ ,๐ผ๐) GetBits takes as input ๐ ๐ก ๐ and outputs a bit ๐ฆ ๐ and an updated state ๐ ๐ก ๐+1 . That is, (๐ฆ ๐ , ๐ ๐ก ๐ ) := GetBits( ๐ ๐ก ๐โ1 ), ๐=1,2, . . .
3
Linear Feedback Shift Registers (LFSR)
(๐=5) ๏
๏
๐ 3 x ๐ 4 ๐ 3 x ๐ 3 ๐ 3 x ๐ 2 ๐ 3 x ๐ 1 ๐ 3 x ๐ 0 ๐ ๐ ๐ก+1 := ๐ ๐+1 ๐ก , ๐=0,โฆ, ๐โ2 ๐ ๐โ1 ๐ก+1 := ๏
๐=0 ๐โ1 ๐ ๐ ๐ ๐ ๐ก Output: ๐ฆ ๐ = ๐ ๐โ1 ๐ก , ๐ก=1,โฆ, ๐, ๐=๐ก ๐ฆ ๐ = ๏
๐=0 ๐โ1 ๐ ๐ ๐ฆ ๐โ๐+๐โ1 , ๐>๐
4
Reconstruction attacks
Solve for unknowns: ๐ 0 , , ๐ ๐โ1 So we must use nonlinear feedback ๐ฆ ๐+1 = ๐ ๐โ1 ๐ฆ ๐ ๏
โฏ ๏
๐ 0 ๐ฆ 1 โฎ ๐ฆ 2๐ = ๐ ๐โ1 ๐ฆ 2๐โ1 ๏
โฏ ๏
๐ 0 ๐ฆ ๐ ๐ ๐ ๐ก+1 := ๐ ๐+1 ๐ก , ๐=0,โฆ, ๐โ2 ๐ ๐โ1 ๐ก+1 := ๐(๐ 0 ๐ก , , ๐ ๐โ1 ๐ก ), some nonlinear function ๐
5
Self-shrinking generator
The self-shrinking generator uses alternating output bits of a single register to control its final output. Clock two bits from the LFSR. If the pair is 10 output a zero. If the pair is 11 output a one. Otherwise, output nothing. Return to step one.
6
Self-shrinking generator, Example
Use polynomial: x8 + x4 + x3 + x2 + 1 Initial state: t 8 7 6 5 4 3 2 1 Out1 Out2 n/a
7
Other nonlinear stream ciphers
Trivium, eSTREAM project --see textbook These are hardware implementations of PRNG Next we shall consider a software implementation.
8
RC4 Init for RC4 (key scheduling) Algorithm 6.1 Input 16 byte key ๐
Output Initial state (๐,๐,๐), ๐ is a permutation of 0, ,255, ๐, ๐ ๐ {0, , 255} for ๐=0 to 255 ๐ ๐ โ๐, ๐ ๐ โ๐[๐ ๐๐๐ 16] ๐ โ0 ๐โ๐+๐ ๐ +๐[๐] Swap ๐[๐] and ๐ ๐ Return ๐,๐,๐
9
RC4 GetBits for RC4 (Algorithm 6.2) Input: (๐,๐,๐)
Output: byte y, updated state (๐,๐,๐) ๐ โ๐+1 ๐ โ๐+๐ ๐ Swap ๐[๐] and ๐ ๐ ๐ก โ๐ ๐ +๐[๐] ๐ฆ โ๐[๐ก] Return ๐,๐,๐ , ๐ฆ ๐ฆ
10
Attacks on RC4 There are several attacks on RC4 known for some time and therefore this stream cipher should not be used anymore. A serious attack occurs when an IV is prepended to the to the key. This attack can be used to recover the key (regardless of it length) This attack was used to break the WEP encryption standard, and was influential in getting the standard replaced---see textbook for details of the attack.
11
Block ciphers A block cipher is an efficient keyed permutation
๐น :{0,1 } ๐ ร{0,1 } ๐ โ{0,1 } ๐ ๐น ๐ ๐ฅ โ๐น(๐,๐ฅ) is a bijection, and ๐น ๐ and its inverse ๐น ๐ โ1 are efficiently computable given ๐. Block ciphers should be viewed as pseudorandom permutations rather than as encryption schemes. They are a basic building blocks for symmetric key applications.
12
Block ciphers We refer to ๐ as the key length and ๐ as the block length of ๐น. These are now constants (fixed) whereas earlier they where functions of the security parameter. This takes us away from the asymptotic security to concrete security.
13
Substitution-Permutation Networks
A block cipher must behave like a random permutation. However there are 2 ๐ ! permutations on ๐-bit strings, so representing an arbitrary permutation with block length ๐ requires roughly log ( 2 ๐ !)โ ๐โ 2 ๐ bits. Thus, we need to somehow construct a concise function that behaves like a random function
14
The confusionโdiffusion paradigm
Idea (Shannon): construct a random looking permutation ๐น with large block length using smaller random looking substitutions { ๐ ๐ } with small length. A substitution-permutation network is an implementation of this paradigm.
15
The confusionโdiffusion paradigm
The substitution component refers to small random functions ๐ ๐ called S-boxes and the permutation component refers to the mixing of the outputs of the random functions. The permutation component involves the reordering of the output bits and are called mixing permutations.
16
The confusionโdiffusion paradigm An example, 1
Suppose we want ๐น to have block length 128 bits, and use 16 substitutions ๐ 1 , .. . , ๐ 16 that have block length 8 bits. The key ๐ will specify the 16 substitutions. For input ๐ฅโ{0,1 } 128 we parse ๐ฅ as ๐ฅ 1 , โฆ, ๐ฅ 16 and set ๐น ๐ ๐ฅ = ๐ 1 ๐ฅ 1 || โฏ ||๐ 16 ๐ฅ 16 The โroundโ functions { ๐ ๐ } are said to introduce confusion.
17
The confusionโdiffusion paradigm An example, 2
A diffusion step then mixes the bits of the output. For example the bits of ๐น ๐ ๐ฅ are shuffled to get ๐ฅโฒ. The confusion-diffusion process is repeated several times A substitution-permutation network is an implementation of this paradigm.
18
The confusionโdiffusion paradigm An example, 3
Consider an SPN network with 64 bit block length and 8 bit ๐-boxes, ๐ 1 , โฆ, ๐ 8 . Evaluating the cipher proceeds in a number of rounds in which: Key mixing: set ๐ฅโ๐ฅ ๏
๐, where ๐ is the current โround sub-keyโ. Substitution: set ๐ฅโ ๐ 1 ( ๐ฅ 1 )||โฏ|| ๐ 8 ๐ฅ 8 . Permutation: Permute the bits of ๐ฅ to get the output for the next round.
19
Substitution-permutation network Example 3, single round
20
The confusionโdiffusion paradigm
The basic idea is to break the input up into small parts and then feed these parts through different S-boxes (random permutations). The outputs are then mixed together. The process is repeated a given number of times, called a rounds. The S-boxes introduce confusion into the construction. In order to spread the confusion throughout, the results are mixed together, achieving diffusion.
21
Any SPN is invertible (given the key)
It suffices to invert each round. Given the SPN output for a round and the key we: First invert the mixing permutation Then invert the ๐-box permutations Finally XOR the result with the appropriate sub-key to get the round input.
22
The avalanche effect An important property in any block cipher is that small changes to the input must result in large changes to the output. To ensure this, block ciphers are designed so that small changes in the input propagate quickly to very large changes in the intermediate values.
23
The avalanche effect It is easy to demonstrate that the avalanche effect holds in a substitution-permutation network, when the following hold: The ๐-boxes are designed so that any change of at least a single bit to the input to an ๐-box results in a change of at least two bits in the output. The mixing permutations are designed so that the output bits of any given ๐-box are spread into different ๐-boxes in the next round.
24
Feistel Networks A Feistel* network is an alternative way of constructing a block cipher. The low-level building blocks (S-boxes, mixing permutations and key schedule) are the same. The difference is in the high-level design. The advantage of Feistel networks over substitution permutation networks is that they enable the use of S-boxes that are not necessarily invertible. * Horst Feistel who did pioneering research while working for IBM
25
Feistel Networks This is important because a good block cipher has chaotic behavior (it should look random). Requiring that all of the components of the construction be invertible inherently introduces structure, which contradicts the need for chaos.
26
Feistel Networks A Feistel network is thus a way of constructing an invertible function from non-invertible components. This seems like a contradiction in terms---if you cannot invert the components, how can you invert the overall structure. Nevertheless, the Feistel design ingeniously overcomes this obstacle.
27
A Feistel network For input ๐ฅ, denote by ๐ฅ 1 and ๐ฅ 2 the first and second halves of ๐ฅ respectively. Let ๐ฃ 1 = ๐ฅ 1 and ๐ฃ 2 = ๐ฅ 2 . For ๐=1 to ๐ (where ๐ is the number of rounds in the network): Let ๐ค 1 = ๐ฃ 2 and ๐ค 2 = ๐ฃ 1 ๏
๐ ๐ ( ๐ฃ 2 ), where ๐ ๐ denotes the ๐-function in the ๐-th round of the network. Let ๐ฃ 1 = ๐ค 1 and ๐ฃ 2 = ๐ค 2 . The output ๐ฆ is (๐ฃ 1 , ๐ฃ 2 ).
28
Feistel Network . mmm mm m
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.