2 - Stream Ciphers Flashcards
Block Cipher
Split plaintext into blocks of fixed length; encrypt each block with same key
Stream Cipher
Works on bit streams and encrypts bits as they come.
Uses less memory/resources
Stream Cipher components
Plaintext: m = m1 m2 m3 …
Keystream: k = k1 k2 k3 …
Ciphertext: c = m ⊕ k (bitwise xor)
Bitwise XOR
in1 in2 Res
o 0 0
0 1 1
1 0 1
1 1 0
in1 + in2 mod 2
Plaintext 1101 0110
Keystream 0011 0101
Has cipher text:
1110 0011
Ciphertext 1110 0011
Key stream 0011 0101
Plain text:
1101 0110
bitwise XOR works this way also!
What is the issue with bitwse XOR and keystreams?
Plaintext XOR Ciphertext = keystream
Obtaining both plaintext and ciphertext reveals the keystream
Why use Bitwise XOR
Easy to decrypt (simple operation)
Easy implementation
- Gates in hardware
- Also simple in software
BUT attacker can determine keystream from plain and ciphertext
One-time pad
A stream cipher in which A&B exchange over a secure channel the whole keystream k, which is truly random
A new keystream is used for each message.
3 issues with One time pad
Very expensive
- Length of keystream must match length of ALL messages sent
- True random bits must be generated
One time pad security
Cannot be broken, even with unlimited resources
- Known ciphertext: Exhaustive keysearch can not distinguish correct plaintext as all keystreams are equally likely (random)
- Known plaintext: Each message uses a new keystream!
Pseudo-random number generators
When true randomness is infeasible, use generators (at cost of losing security guarantee of one time pad)
How do pseudorandom generators generally work? (Linear Congruential)
- Start with a seed
s0 = seed - Use a formula like
s[n] = (a s[n-1] + b) mod M
NOTE: Will cycle - not entirely random. Only M possible numbers and only depends on previous number.
Should you generate a random bit sequence in binary?
Very insecure. USe only the least significant bit or another
Linear Congruential generator
Where is it used? Is it strong enough?
Commonly used for rand() function in programming.
TOO WEAK FOR cryptographic applications.