WEP Working
WEP Working
S[i]=i
J=0
Scrambling:
For i=0 ... index-1
Swap(state[i] , state[j])
A loop first runs from 0 to index-1 to initialize the state array with values from 0 to
index. For eg. If index =4 the state array will be filled with values from 0 to 3.
Therefore the array values will be as follows:
s[0]=0 s[1]=1 s[2]=2 s[3]=3
The value of j is set to 0. Another loop is then started. For every time through the
loop, the value of j is calculated, and the array value held in state[i] is swapped for
the value held in state[j] .
Pseudo Random Generation Algorithm (PRGA)
A pseudorandom number generator (PRNG) is an algorithm that generates a
random sequence of numbers. The PRGA is responsible for creating the streaming
values used to encrypt the plaintext, which is based on the state array, the output
of the KSA . The methodology that the PRGA follows is outlined below.
Initialization:
I=0 j=0 index=4
Generation Algorithm
I=(i+1) mod index
Swap(state[i], state[j])
Step-2
i=1 j=2
Step 3
i=2 j=1
Step 4
i=3 j=3
i=1 j=0+State[1]=0+0=0
z1 = 00000001
Second Loop:
State[0]=0 State[1]=1 State[2]=3 State[3]=2
i=2 j=0+State[2]=3
z2 = 00000001
Third Loop:
State[0]=0 State[1]=1 State[2]=2 State[3]=3
Swap(State[3],State[2]) = Swap(3,2)
z3=00000001
Fourth Loop:
State[0]=0 State[1]=1 State[2]=3 State[3]=2
State[2]] = State[3] = 2
z4=00000010
The outputs z1-z4 at the end of each loop must be Xor'ed with the ASCII of each
character of plain text which in our case is TEST. Hence the cipher text for the plain
text TEST will be as follows:
T xor z1 = 01010100 xor 00000001 = 01010101 = U
Binary Decimal Hex Graphic Binary Decimal Hex Graphic Binary Decimal Hex Graphic
0010 0000 32 20 (blank) (␠) 0100 0000 64 40 @ 0110 0000 96 60 `
0010 0001 33 21 ! 0100 0001 65 41 A 0110 0001 97 61 a
0010 0010 34 22 " 0100 0010 66 42 B 0110 0010 98 62 b
0010 0011 35 23 # 0100 0011 67 43 C 0110 0011 99 63 c
0010 0100 36 24 $ 0100 0100 68 44 D 0110 0100 100 64 d
0010 0101 37 25 % 0100 0101 69 45 E 0110 0101 101 65 e
0010 0110 38 26 & 0100 0110 70 46 F 0110 0110 102 66 f
0010 0111 39 27 ' 0100 0111 71 47 G 0110 0111 103 67 g
0010 1000 40 28 ( 0100 1000 72 48 H 0110 1000 104 68 h
0010 1001 41 29 ) 0100 1001 73 49 I 0110 1001 105 69 i
0010 1010 42 2A * 0100 1010 74 4A J 0110 1010 106 6A j
0010 1011 43 2B + 0100 1011 75 4B K 0110 1011 107 6B k
0010 1100 44 2C , 0100 1100 76 4C L 0110 1100 108 6C l
0010 1101 45 2D - 0100 1101 77 4D M 0110 1101 109 6D m
0010 1110 46 2E . 0100 1110 78 4E N 0110 1110 110 6E n
0010 1111 47 2F / 0100 1111 79 4F O 0110 1111 111 6F o
0011 0000 48 30 0 0101 0000 80 50 P 0111 0000 112 70 p
0011 0001 49 31 1 0101 0001 81 51 Q 0111 0001 113 71 q
0011 0010 50 32 2 0101 0010 82 52 R 0111 0010 114 72 r
0011 0011 51 33 3 0101 0011 83 53 S 0111 0011 115 73 s
0011 0100 52 34 4 0101 0100 84 54 T 0111 0100 116 74 t
0011 0101 53 35 5 0101 0101 85 55 U 0111 0101 117 75 u
0011 0110 54 36 6 0101 0110 86 56 V 0111 0110 118 76 v
0011 0111 55 37 7 0101 0111 87 57 W 0111 0111 119 77 w
0011 1000 56 38 8 0101 1000 88 58 X 0111 1000 120 78 x
0011 1001 57 39 9 0101 1001 89 59 Y 0111 1001 121 79 y
0011 1010 58 3A : 0101 1010 90 5A Z 0111 1010 122 7A z
0011 1011 59 3B ; 0101 1011 91 5B [ 0111 1011 123 7B {
0011 1100 60 3C < 0101 1100 92 5C \ 0111 1100 124 7C |
0011 1101 61 3D = 0101 1101 93 5D ] 0111 1101 125 7D }
0011 1110 62 3E > 0101 1110 94 5E ^ 0111 1110 126 7E ~
0011 1111 63 3F ? 0101 1111 95 5F _