Presentation is loading. Please wait.

Presentation is loading. Please wait.

Implementing the RC4 Algorithm

Similar presentations


Presentation on theme: "Implementing the RC4 Algorithm"— Presentation transcript:

1 Implementing the RC4 Algorithm

2 Simple Cryptography . The book, “Codes Ciphers and Computers” (Bosworth) describes modulo 2 addition as binary addition without the carry. It is commonly called an exclusive OR (XOR). The symbol () is used to represent an exclusive OR.

3 Simple Cryptography The rules for modulo 2 addition () are: 1  1 = 0
1  0 = 1 0  1 = 1 0  0 = 0

4 Simple Cryptography Using the ASCII character set to represent a plain text message, “Hello!” and a secret key, “Secret” in binary bit strings we can  them together to produce a cipher text message.

5 Simple Cryptography Message: H e l l o !
Secret Key: S e c r e t = Cipher text:

6 Simple Cryptography To undo the cipher text,  the cipher text with the same secret key and the original message is reproduced.

7 Simple Cryptography Secret Key: S e c r e t
Cipher text:   = Message: H e l l o !

8 Stream Ciphers A stream cipher starts with a small secret key that is permutated into a cryptographic bit-stream. The bit-stream generator (C) is used to  a plaintext message (M) into a cipher text message (P). The same algorithm is used on the other end to  the cipher text message back into plaintext. M  C = P Encryption P  C = M Decryption

9 RC4 Dr. Ronald Rivest’s RC4 Stream Cipher has two components.
Stream Setup. Byte Generator.

10 RC4 Stream Setup Two arrays: S[256] and K[256].
S0=0, S1=1, S2=2, …, S255=255. K0= 1st byte of key K1= 2nd byte of key Repeated until end of key Key repeated until K255 is filled

11 RC4 Stream Setup Counters A and B initialized to 0
for (A = 0; A < 256; A++) B=(B + S[A] + K[A]) mod 256 swap S[A] and S[B]

12 RC4 Byte Generator Counters I and J both initialized to 0
I = (I + 1) mod 256 J = (J + S[ I ] ) mod 256 swap S[ I ] and S[ J ] K = ( S[ I ] + S [ J ] ) mod 256 return S[ K ]

13 Initialization Vector (IV)
Stream Ciphers produce the exact same cipher stream when the key is identical. To synchronize the stream an IV is used. It represents the number of permutations needed to produce a cipher byte.

14 RC4 Common Uses IEEE 802.11 Wired Equivalent Privacy (WEP) protocol.
Walker, J. (2000). Unsafe at any key size; An analysis of the WEP encapsulation. IEEE Working Group P Document Number IEE /362 [online] /groups/802/11/Documents/DT html

15 Conclusion RC4 is an easily remembered algorithm RC4 is fast.
RC4 can be implemented in most languages using only a few lines of code.


Download ppt "Implementing the RC4 Algorithm"

Similar presentations


Ads by Google