3.3 Stream ciphers and pseudo-random number generators
3 min read•august 15, 2024
Stream ciphers are a crucial part of symmetric key cryptography, encrypting data bit by bit using a . They're fast and efficient, making them ideal for real-time applications or resource-limited devices. Understanding how they work is key to grasping modern methods.
Pseudo-random number generators (PRNGs) are the heart of stream ciphers, creating the key stream that scrambles the data. These generators must be unpredictable and produce long, non-repeating sequences to ensure security. Knowing PRNG principles helps you appreciate the complexity behind seemingly simple encryption processes.
Stream cipher principles
Key characteristics and operation
Top images from around the web for Key characteristics and operation
Block cipher mode of operation - Wikipedia View original
Is this image relevant?
Block cipher mode of operation - Wikipedia View original
Is this image relevant?
1 of 1
Top images from around the web for Key characteristics and operation
Block cipher mode of operation - Wikipedia View original
Is this image relevant?
Block cipher mode of operation - Wikipedia View original
Is this image relevant?
1 of 1
Stream ciphers encrypt plaintext one bit or byte at a time, unlike block ciphers which operate on fixed-size blocks
Key stream generation uses a pseudo-random number generator (PRNG) initialized with a secret key and initialization vector (IV)
Encryption combines key stream with plaintext using bitwise XOR operation
Security depends on unpredictability and non-repeatability of the key stream
Two main categories exist:
Synchronous stream ciphers generate key stream independently of plaintext/ciphertext
Self-synchronizing stream ciphers generate key stream based on previous ciphertext bits
Offer faster performance and lower computational requirements compared to block ciphers (suitable for resource-constrained environments or high-speed applications)
Security requirements and considerations
Critical security requirement prohibits reusing the same key stream more than once (prevents two-time pad attack vulnerability)
Key stream must be indistinguishable from truly random sequences
Requires large internal state to resist reconstruction attacks (typically twice the size of desired security level in bits)
Forward secrecy protects past outputs even if current state compromised
Common designs incorporate:
Linear feedback shift registers (LFSRs)
Non-linear feedback shift registers (NLFSRs)
Combinations with additional non-linear components
Pseudo-random number generators in stream ciphers
PRNG fundamentals and requirements
PRNGs produce sequences of numbers that appear random but generate through deterministic mathematical process
Seed or initial state derives from secret key and initialization vector
Cryptographically secure PRNGs must have long period (sequence should not repeat for very large number of generated bits)
Statistical crucial for generated sequences to pass various randomness tests
Internal state size must be sufficiently large to resist state reconstruction attacks
PRNG properties for stream cipher security
Unpredictability of output sequence critical for overall cipher security
Long period prevents repetition of key stream
Statistical randomness ensures generated sequences indistinguishable from truly random data
Large internal state size increases resistance to state reconstruction attacks
Forward secrecy protects past outputs even if current state compromised
Stream cipher security and cryptanalysis
Common attack vectors
Known-plaintext attacks reveal portions of key stream with sufficient plaintext-ciphertext pairs
Distinguishing attacks differentiate cipher output from truly random data (indicates design weakness)
Correlation attacks exploit statistical weaknesses in key stream generator to deduce internal state or secret key
Algebraic attacks express cipher as system of equations to solve for secret key or internal state
Time-memory trade-off attacks (Babbage-Golic attack) recover internal state through precomputation and data storage
Initialization attacks target weaknesses in key and IV setup process
Side-channel attacks exploit information leaked through physical implementation (power analysis, timing attacks)
Security considerations and defenses
Unpredictability and non-repeatability of key stream form primary security basis
Proper key and IV management prevents key stream reuse
Strong PRNG design resists various cryptanalytic techniques
Large internal state increases resistance to reconstruction attacks