# Cracking WEP

• Print
• + Share This
From the author of

## KSA

The Key Scheduling Algorithm is the first part of the encryption process. The following is the algorithm actually used in RC4 by line with an explanation for each line.

### Algorithm

```1. Assume N = 256
2. K[] = Secrete Key array
3. Initialization:
4. For i = 0 to N – 1
5.   S[i] = i
6. j = 0
7. Scrambling:
8. For i = 0 ... N – 1
9.   j = j + S[i] + K[i]
10.  Swap(S[i], S[j])```

### Explanation

1. N is an index value. It determines how strong the scrambling process is. WEP uses a value of 256.

2. K is the letter used to symbolize the secret key array. In the case of a five-character, pre-shared key, this value would be the three-character IV + five-character pre-shared key ‡ eight-character secret key. Each character is held in the corresponding K position. This value does not get scrambled.

3. This starts the initialization of the KSA. It basically is used to seed the empty State (S[]) array with values 0–255.

4. This is the start of the loop process that increases the value of i each time the algorithm loops.

5. Once it is done, the S array will hold values 0–255 in corresponding array position 0–255.

6. j is used to hold a value during the scrambling process, but it must first be initialized to ensure that it always starts at 0.

7. This starts the scrambling process that creates the psuedo random S array from the previously seeded S array.

8. Another loop that ensures the scrambling process occurs 256 times.

9. This is the equation used to merge the properties of the secret key with the state array (S[]) to create a psuedo random number, which is assigned to j.

10. Finally, a swap function is performed to swap the value held in S[i] with the value held in S[j].

As you can see, this is not a terribly complex process. Some simple math based on the secret key, and you have a psuedo random state array. The next part takes this array and creates a stream of data that is used to encrypt the data to be sent over the airwaves.

• + Share This
• 🔖 Save To Your Account