Lec 11 StreamCiphers
Lec 11 StreamCiphers
Stream Ciphers
The One-Time Pad
One-Time Pad or Vernam Cipher
Encryption:
1001001 1000110 plaintext
1010110 0110001 key
ciphertext
Decryption:
0011111 1110110 ciphertext
1010110 0110001 key
plaintext
Why One-Time Pad is provably secure?
Or how can we prove it is unbreakable?
Drawback
Initialization
for i = 0 to 255 do
S[i] = i
T[i] = K[i mod keylen])
Initial Permutation of S
j=0
for i = 0 to 255 do
j = (j + S[i] + T[i]) mod 256
swap (S[i], S[j])
RC4 Encryption
• Encryption continues shuffling array values
• Sum of shuffled pair selects "stream key" value from permutation
• Xor S[t] with next byte of message to en/decrypt
Stream Generation
i=j=0
for each message byte Mi
i = (i + 1) mod 256
j = (j + S[i]) mod 256
swap(S[i], S[j])
t = (S[i] + S[j]) mod 256
k = S[t]
Encryption: Ci = Mi XOR k
Decryption: Mi = Ci XOR k
RC4 Overview
Linear Feedback Shift Register
(LFSR) Sequences
• The sequence
01000010010110011111000110111010100001001011001111
x1 = 0, x2 = 1, x3 = 0, x4 = 0, x5 = 0;
Output sequence
bn bn-1 b2 b1
Feedback Function
• A feedback shift register is made up of two parts: a shift register and a feedback
function
• The shift register is a sequence of bits, if it is n-bit long, it is called n bit shift
register
• Each time a bit is needed, all bits in the shifted register are shifted 1 bit to right
• The new leftmost bit is computed as a function of the other bits using feedback
function
• The output of shift register is 1 bit, often least significant bit
• The period of a shift register is the length of the output sequence before it starts
Linear Feedback Shift Register - LFSR
Output bit
bn bn-1 b2 b1
…………
• The simplest kind of feedback shift register is a linear feedback shift register
(LFSR), the feedback function is simply XOR of certain bits in the register, the
list of these bits is called a tap sequence
Output bit
b4 b3 b2 b1
Linear Feedback Shift Register - LFSR
1. Large period
2. Large Linear Complexity
3. Good Statistical Properties
Nonlinear combination Generator