Download presentation
Presentation is loading. Please wait.
Published byAlana Woodham Modified over 9 years ago
2
Stream Ciphers
4
Part 1 Cryptography 3 Stream Ciphers
5
Part 1 Cryptography 4 Stream Ciphers Once upon a time, not so very long ago, stream ciphers were the king of crypto Today, not as popular as block ciphers We’ll discuss two stream ciphers… A5/1 – Based on shift registers – Used in GSM mobile phone system RC4 – Based on a changing lookup table – Used many places
6
Part 1 Cryptography 5 A5/1: Shift Registers A5/1 uses 3 shift registers –X : 19 bits (x 0,x 1,x 2, …,x 18 ) –Y : 22 bits (y 0,y 1,y 2, …,y 21 ) –Z : 23 bits (z 0,z 1,z 2, …,z 22 )
7
Part 1 Cryptography 6 A5/1: Keystream At each step: m = maj(x 8, y 10, z 10 ) – Examples: maj(0,1,0) = 0 and maj(1,1,0) = 1 If x 8 = m then X steps – t = x 13 x 16 x 17 x 18 – x i = x i 1 for i = 18,17,…,1 and x 0 = t If y 10 = m then Y steps – t = y 20 y 21 – y i = y i 1 for i = 21,20,…,1 and y 0 = t If z 10 = m then Z steps – t = z 7 z 20 z 21 z 22 – z i = z i 1 for i = 22,21,…,1 and z 0 = t Keystream bit is x 18 y 21 z 22
8
Part 1 Cryptography 7 A5/1 Each variable here is a single bit Key is used as initial fill of registers Each register steps (or not) based on maj (x 8, y 10, z 10 ) Keystream bit is XOR of rightmost bits of registers y0y0 y1y1 y2y2 y3y3 y4y4 y5y5 y6y6 y7y7 y8y8 y9y9 y 10 y 11 y 12 y 13 y 14 y 15 y 16 y 17 y 18 y 19 y 20 y 21 z0z0 z1z1 z2z2 z3z3 z4z4 z5z5 z6z6 z7z7 z8z8 z9z9 z 10 z 11 z 12 z 13 z 14 z 15 z 16 z 17 z 18 z 19 z 20 z 21 z 22 X Y Z x0x0 x1x1 x2x2 x3x3 x4x4 x5x5 x6x6 x7x7 x8x8 x9x9 x 10 x 11 x 12 x 13 x 14 x 15 x 16 x 17 x 18
9
Part 1 Cryptography 8 A5/1 In this example, m = maj(x 8, y 10, z 10 ) = maj(1,0,1) = 1 Register X steps, Y does not step, and Z steps Keystream bit is XOR of right bits of registers Here, keystream bit will be 0 1 0 = 1 1100110011001100110001 11100001111000011110001 X Y Z 1010101010101010101
10
Part 1 Cryptography 9 Shift Register Crypto Shift register crypto efficient in hardware Often, slow if implement in software In the past, very popular Today, more is done in software due to fast processors Shift register crypto still used some – Resource-constrained devices
11
Part 1 Cryptography 10 RC4 A self-modifying lookup table Table always contains a permutation of the byte values 0,1,…,255 Initialize the permutation using key At each step, RC4 does the following – Swaps elements in current lookup table – Selects a keystream byte from table Each step of RC4 produces a byte – Efficient in software Each step of A5/1 produces only a bit – Efficient in hardware
12
Part 1 Cryptography 11 RC4 Initialization S[] is permutation of 0,1,...,255 key[] contains N bytes of key 1. In step 1, state is initialized to values 1,1,…255 2.A key array K[0], K[1],……….K[255] is also created for i = 0 to 255 S[i] = i K[i] = key[i (mod N)] // N=keylength next i In second state initialized state goes through a permutation. j = 0 for i = 0 to 255 { j = (j + S[i] + K[i]) mod 256 swap(S[i], S[j]) } next i
13
Part 1 Cryptography 12 RC4 Keystream generation For each keystream byte, swap elements in table and select byte i = j = 0 (initialised to 0 before first iteration) i = (i + 1) mod 256 j = (j + S[i]) mod 256 swap(S[i], S[j]) t = (S[i] + S[j]) mod 256 keystreamByte = S[t] Use keystream bytes like a one-time pad Note: first 256 bytes should be discarded – Otherwise, related key attack exists
14
Part 1 Cryptography 13 Stream Ciphers Stream ciphers were popular in the past – Efficient in hardware – Speed was needed to keep up with voice, etc. – Today, processors are fast, so software-based crypto is usually more than fast enough Future of stream ciphers? – Shamir declared “the death of stream ciphers” – May be greatly exaggerated…
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.