Professional Documents
Culture Documents
Stream Cipher
Stream Cipher
Stream Cipher
1
Stream Cipher
Encryption
Decryption
2
Pseudo-Random Functions
𝑏 ← 0, 1 , 𝑘 ∈ 𝐾 if ∃ 𝑥, 𝑦 ′ ∈ 𝐿: 𝑦 ← 𝑦 ′
𝑥∈𝐷
{𝐹𝑘 }𝐾 elif 𝑏 = 0: y ← 𝐶
else: 𝑦 ← 𝐹𝑘 𝑥
𝑏‘ 𝐿 ← 𝐿 ∪ {𝑥, 𝑦}
𝑦
𝐶 𝐴 Oracle 𝑶𝐹𝑘
A wins if 𝑏‘ = 𝑏
𝑃𝑅𝐹 1
𝐴𝑑𝑣 𝐹𝑘 𝐾 𝐴 = 2 ∙ Pr[ 𝐴 𝑤𝑖𝑛𝑠] − = Pr 𝑏′ = 1 𝑏 = 1 − Pr 𝑏′ = 1 𝑏 = 0
2
3
Pseudo-Random-Function Families
• Kerckhoff‘s principle
Security should entirely rest on the chosen key and not on the
knowledge of the encryption algorithm!
4
Stream Cipher Depends on Strength of PRF
Compare IND-PASS game 𝐺0 for a scheme 𝑐 ∗ ← 𝑚𝑏 ⊕ 𝐹𝑘 (0)
𝑏0 ← 0, 1 𝑚0 , 𝑚1 ∈ 𝑃 𝑐 ∗ ← 𝑚𝑏0 ⊕ 𝐹𝑘 (0)
𝑘 ∈ 𝐾𝑒𝑦𝐺𝑒𝑛𝑃𝑅𝐹 () 𝑐∗
𝑏0 ‘ 𝑶𝐿𝑅
𝐴 wins if 𝑏0 ‘=𝑏0
𝐶 𝐴
𝑏1 ← 0, 1 𝑚0 , 𝑚1 ∈ 𝑃 𝑐 ∗ ← 𝑚𝑏1 ⊕ 𝑅𝑎𝑛𝑑(0)
𝑘 ∈ 𝐾𝑒𝑦𝐺𝑒𝑛𝑃𝑅𝐹 () 𝑐∗
𝐴 wins if 𝑏1 ‘=𝑏1 𝑏1 ‘ 𝑶𝐿𝑅
𝐶 𝐴
𝐴𝑑𝑣 𝑃𝑅𝐹 ′ ′ ′ ′
𝐹𝑘 𝐾 𝐴 = Pr 𝑏0 = 1 𝑏0 = 1 − Pr 𝑏1 = 1 𝑏1 = 1 = Pr 𝑏0 = 0 𝑏0 = 0 − Pr 𝑏1 = 0 𝑏1 = 0
5
Pseudo-Random Generator PRG
6
Linear Feedback Shift Registers (LFSR)
Shift register
𝑏𝑛−1 𝑏𝑛−2 … 𝑏2 𝑏1 𝑏0 Output bits
𝑐1 𝑐2 𝑐𝑛−2 𝑐𝑛−1
𝑐𝑛
𝑏𝑛 = σ𝑛−1
𝑗=0 𝑐𝑗 ∙ 𝑏𝑗
7
Outputs and States of a LFSR
8
Some Properties of LFSR
Definition
A sequence 𝑜0 , 𝑜1 , … has period 𝑟 iff 𝑜𝑗 = 𝑜𝑗+𝑟 for all 𝑗 ≥ 0
Lemma
An 𝑛-bit LFSR has at most a period of 2𝑛 − 1
Proof:
An 𝑛-bit LFSR can encode at most 2𝑛 states. The 0 - state is not usable
as a state. Since the successor state is uniquely determined by the
actual state, the LSFR will eventually return (after at most 2𝑛 − 1
transitions) to a previously seen state (and then cycle infinitely).
9
Connection Polynomial
Definition
Given 𝑐1 … 𝑐𝑛 the (binary) connection polynomial is
– 𝐶 𝑋 = 1 + 𝑐1 𝑋 + 𝑐2 𝑋 2 + ⋯ + 𝑐𝑛 𝑋 𝑛
Examples
𝑏3 𝑏2 𝑏1 𝑏0
𝐶 𝑋 = 1 + 𝑋 + 𝑋3
𝑐1 𝑐3
10
Connection Polynomial and Periods (I)
Consider 𝑐𝑛 = 0:
• Register is longer than the degree of connection polynomial,
sequence is singular
• Sequence may not periodic but eventually become periodic
Example:
𝐶 𝑋 = 1 + 𝑋 + 𝑋3
State transitions
11
Connection Polynomial and Periods (II)
Example:
𝐶 𝑋 = 1 + 𝑋 + 𝑋2 + 𝑋3 + 𝑋4 State transitions
12
Connection Polynomial and Periods (III)
Example:
𝐶 𝑋 = 1 + 𝑋 + 𝑋4
State transitions
An irreducible polynomial 𝐹(𝑥) of degree 𝑚 over 𝐺𝐹(𝑝), where 𝑝 is prime, is a primitive polynomial
if the smallest positive integer 𝑛 such that 𝐹(𝑥) divides 𝑥 𝑛 − 1 is 𝑛 = 𝑝𝑚 − 1.
13
Linear LFSR are Insecure
Lemma
If an attacker knows 2 ∙ 𝑛 consecutive bits of the sequence, then he
knows its entire continuation
Proof:
Suppose, we know the output 𝑜1 … 𝑜2𝑛 .
According to construction 𝑜𝑛+𝑚 = σ𝑛−1
𝑗=0 𝑐𝑛−𝑗 ∙ 𝑜𝑗+𝑚 holds for 𝑚 > 0
14
Beyond Linearity – Combining LFSR
Different approaches to combine LFSRs (of different sizes !) to
overcome linearity:
Multiplexer
𝑓 …
Pass or
drop bit
15
Example: GSM a‘la A5 / 1 Generator
Stay tuned !
17