Understanding Cryptography CHPTR 2 - Stream Ciphers
Understanding Cryptography CHPTR 2 - Stream Ciphers
www.crypto-textbook.com
These slides were prepared by Thomas Eisenbarth, Christof Paar and Jan Pelzl
Some legal stuff (sorry): Terms of Use
• The slides can used free of charge. All copyrights for the slides remain with
the authors.
• The title of the accompanying book “Understanding Cryptography” by
Springer and the author’s names must remain on each slide.
• If the slides are modified, appropriate credits to the book authors and the
book title must remain within the slides.
• It is not permitted to reproduce parts or all of the slides in printed form
whatsoever without written consent by the authors.
Cryptology
Cryptography Cryptanalysis
• Stream Ciphers
• Encrypt bits individually
• Usually small and fast common in embedded devices (e.g., A5/1 for
GSM phones)
• Block Ciphers:
• Always encrypt a full block (several bits)
• Are common for Internet applications
xi si yi
0 0 0
0 1 1
1 0 1
1 1 0
RNG
Typically used for generation of keys, nonces (used only-once values) and for
many other purposes
s0 = seed
si +1 = f ( si , si −1 ,..., si −t )
s0 = 12345
si +1 = 1103515245si + 12345 mod 231
S 0 = seed
Si +1 = ASi + B mod m
Assume
• unknown A, B and S0 as key
• Size of A, B and Si to be 100 bit
• 300 bit of output are known, i.e. S1, S2 and S3
Solving
S 2 = AS1 + B mod m
S3 = AS 2 + B mod m
…directly reveals A and B. All Si can be computed easily!
More precisely: Given n consecutive bits of output si , the following output bits sn+1
cannot be predicted (in polynomial time).
One-Time Pad
• A cryptosystem developed by Mauborgne that is based on Vernam’s stream
cipher:
• Properties:
Let the plaintext, ciphertext and key consist of individual bits
xi, yi, ki ∈ {0,1}.
OTP is unconditionally secure if and only if the key ki. is used once!
• Concatenated flip-flops (FF), i.e., a shift register together with a feedback path
• Feedback computes fresh input by XOR of certain state bits
• Degree m given by number of storage elements
• If pi = 1, the feedback connection is present (“closed switch), otherwise there is
not feedback from this flip-flop (“open switch”)
• Output sequence repeats periodically
• Maximum output length: 2m-1
21/27 Chapter 2 of Understanding Cryptography by Christof Paar and Jan Pelzl
Linear Feedback Shift Registers (LFSRs): Example with m=3
si +3 = si +1 + si mod 2 2 1 0 1
3 1 1 0
4 1 1 1
• Maximum output length (of 23-1=7) achieved only for certain
5 0 1 1
feedback configurations, .e.g., the one shown here.
6 0 0 1
7 1 0 0
8 0 1 0
22/27 Chapter 2 of Understanding Cryptography by Christof Paar and Jan Pelzl
Security of LFSRs
LFSRs typically described by polynomials:
P ( x) = x m + pl −1 x m −1 + ... + p1 x + p0
Initialization:
• Load 80-bit IV into A
• Load 80-bit key into B
• Set c109 , c110 , c111 =1, all other bits 0
Warm-Up:
• Clock cipher 4 x 288 = 1152 times without generating output
Encryption:
• XOR-Sum of all three NLFSR outputs generates key stream si
• Stream ciphers sometimes require fewer resources, e.g., code size or chip area, for
implementation than block ciphers, and they are attractive for use in constrained
environments such as cell phones.
• The requirements for a cryptographically secure pseudorandom number generator are far
more demanding than the requirements for pseudorandom number generators used in other
applications such as testing or simulation
• The One-Time Pad is a provable secure symmetric cipher. However, it is highly impractical
for most applications because the key length has to equal the message length.
• Single LFSRs make poor stream ciphers despite their good statistical properties. However,
careful combinations of several LFSR can yield strong ciphers.