Stream Cipher-RC4
Stream Cipher-RC4
Network Security
1
Content
• Random Numbers
• Stream Cipher
• Introduction to Rivest Cipher 4 (RC4)
Key Scheduling Algorithm (KSA)
2
Symmetric Cipher Type
• Way in which plaintext is processed: (Recap)
1. Block (only one block at a time)
3
Random Numbers
•Key Generation: Random numbers are used to generate cryptographic
keys.
•Initialization Vectors (IV): It used to introduce randomness into the
encryption process.
•Nonces: Random numbers in cryptography that are used once to
prevent replay attacks and ensure the freshness of data.
•Salt Values: In password-based key derivation functions are used to
enhance the security of stored passwords.
4
Random Numbers
•Generation of asymmetric keys for RSA public-key encryption.
•Generation of key stream for symmetric stream cipher.
•Generation of symmetric key as temporary session key.
•In key distribution scenarios (Kerberos to prevent from reply attack)
5
Pseudorandom
Number Generators
• Pseudorandom Number Generator (PRNG): An algorithm that uses
mathematical formulas to produce sequences of semi-random
numbers.
7
Stream Cipher
•Stream cipher is symmetric encryption method.
8
Stream Cipher
• The key is unpredictable and input to pseudorandom byte generator.
• The output of pseudorandom byte generator is called keystream.
• Keystream will combine with plaintext stream using XOR.
9
Stream Cipher’s benefits
•Speed. This form of encryption is typically faster than block ciphers.
10
Usage of Stream Cipher
•Communication Security: Stream ciphers are widely used to secure
communication channels when data is transmitted, such as voice
calls, video streams, and instant messaging (confidentiality).
12
Rivest Cipher 4 (RC4)
•RC4 was invented in 1987 by Ron Rivest, and it is the most
extensively used stream cipher because of its speed and simplicity.
•Encrypt one byte at a time.
•RC4 generates a pseudorandom stream of bits (a keystream) for
encryption and decryption, is combined using XOR.
•Key size 1 to 256 bytes (8 to 2048 bits).
•Can be used as a random number generator (WEP).
•Popular method for WEP, WPA and SSL.
13
RC4 Structure
•Contain Key Scheduling Algorithm (KSA) and Pseudorandom
Generation Algorithm (PRGA) steps:
Initialization
Stream Generation
14
RC4 Structure
•Key Scheduling Algorithm (KSA)
A variable length key, (usually between 40 and 256 bits), is used to
initialize the 256-byte state vector (S) (permutation)
15
key Scheduling
Algorithm (KSA)
• The key-scheduling algorithm is used to initialize the permutation
in the array "S".
•"Key length" is defined as the number of bytes in the key and can
be in the range 1 ≤ key length ≤ 256, typically between 5 and 16,
corresponding to a key length of 40–128 bits.
18
19
1st Step: Initial State
of S and T
20
2 Step: Initial
nd
Permutation of S
21
3rd Step: Stream
Generation
22
RC4 Disadvantages
•Vulnerabilities: RC4 has several known vulnerabilities that make it
unsuitable for new applications.
•Security weaknesses: RC4 has some inherent weaknesses in its
design.
24
Compare Symmetric Cipher
Factors DES 3DES AES RC4 RC6
Ron Rivest, Matt
Joan
Ron Rivest Robshaw, Ray
Designer IBM 1975 IBM 1978 Daemen and Vinc
1994 Sidney, and Yiqun
ent Rijmen 2001
Lisa Yin 1998
Cipher type Block Block Block Stream Block
128, 192, 256 128, 192, 256
Key length 56 bits 112 bits bits 40-2048 bits
Rounds 16 48 10, 12, 14 256 20
Algorithm Feistel Feistel SPN Feistel Feistel
Structure
Block size 64 bits 64 bits 128 bits - 128 bits
Faster than
Speed Slow Very Slow Fast Fast DES, slower
than AES
Adequate Excellent Adequate
Security Not secure security security Not secure security
25
Summary
• Random Numbers
• Stream Cipher
26
Q&A
Any question?!
27