0% found this document useful (0 votes)
17 views7 pages

2-5 RC4 - Simplified RC4

Uploaded by

vishalyoga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views7 pages

2-5 RC4 - Simplified RC4

Uploaded by

vishalyoga
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

RC4

 RC4 is a stream cipher which was invented by Ron Rivest in the year 1987.
 RC4 means ‘Rivest Cipher 4’ and it is also known as ‘Ron’s Code 4’.
 The RC4 cipher is the most widely used stream cipher. It is used in various
applications that encrypts and decrypts a bit or byte of data at a time.
 For example, if 10 bytes of a file is to be transmitted, then RC4 has to
generate 10 key streams for encrypt ing the plaintext bytes.
 Moreover, it is used by important protocols such as SSL, TSL, WPA and
WEP, etc. because of its simplicity and efficiency.
 The RC4 is an efficient algorithm because it is 5 times faster than DES, 15
times faster than triple DES and 50 times faster than RC2.

Principle of RC4

 The RC4 algorithm generates a pseudo random number which will


be used as a key to encrypt the plaintext and to generate the
corresponding ciphertext.
 The encryption and decryption are performed using an XOR
operation in RC4.
 The pseudo random number is generated from a variable length
key after performing the two algorithms, namely key scheduling
algorithm (KSA) and pseudo random generation algorithm
(PRGA).
 Among the two algorithms, KSA is used to generate the
permutation array.
 PRGA is used to generate a pseudo random number which will be
used as a key stream.
 To implement these two algorithms, initially a 256-byte array S is
declared that contains a permutation of these 256 bytes. Next, two
indexes i and j are used to point the elements in the S array.

The Key-scheduling Algorithm

In this algorithm, the S array is initialized. After that, the index values of S array
are filled into S array.

After filling the values, the values in the S array are permuted.

In order to permute the values, the following steps are executed in the KSA.

• Compute j j = + S i[ ]+ key m[ ] i od keylength

• Swap S[i] and S[ j]

• Increment i

These steps are executed until the i value reaches 256.


The Pseudo Random Generation Algorithm

In this algorithm, the actual key stream is generated which could be used for
performing encryption operation in the sender side.
Encryption and Decryption

Steps of encryption

1. Choose a secret key.

2. Run the KSA to generate the initial permuted array.

3. Run the PRGA to generate a key stream.

4. Now the amount of key stream generated is equal to the amount of bytes
for doing encryption operation.

Steps of decryption

1. Use the same key that was used in the encryption operation.

2. Generate a key stream by running the KSA and PRGA algorithms. 3. XOR is
the key stream with the ciphertext to generate the plaintext

5. XOR with key stream with the plaintext data to generate the encrypted
stream

You might also like