Question Description

An RC4 state is a 256 bytes states with two 8-bit index pointers i and j denoted by (S ,i ,j) The initial RC4 state is generated by KSA demoted by( S0, i=0, j=0).

An important feature of RCA is that the RC4 state is revertible That is, if (S* , i*, j*)=PRGAn (S ,i, j) it has (S ,i, j)=IPRGAn (S* , i*, j*)Where PRGAn demotes applying n rounds PRGA (samefor IPRGAn) and IPRGA is the reverse algorithm of PRGA. This feature means that any former

RC4 state can be recovered from a later RC4 state by applying certain rounds IPRGA.Write code to implementboth the PRGA algorithm and following IPRGA algorithm and design and implement a way confirm that any RC4 state can go forward by PRGA and backward by IPRGA.

IPRGA(S, i , j)

Generation loop;

S[i] ⟷ S[j]

j←(j-S[i ] +256)mod 256

i←(i -1)mod 256

note

1.Source code and related documentation for part one are required .Please compress them into one zip file

2. Your related documentation should include introduction to your code, external comments, how

to nun your code, and all screen shots of running your code, etc. Your source code should

include the internal comments.

An RC4 state is a 256 bytes states with two 8-bit index pointers i and j denoted by (S ,i ,j) The initial RC4 state is generated by KSA demoted by( S0, i=0, j=0).An important feature of RCA is that the RC4 state is revertible That is, if (S* , i*, j*)=PRGAn (S ,i, j) it has (S ,i, j)=IPRGAn (S* , i*, j*)Where PRGAn demotes applying n rounds PRGA (samefor IPRGAn) and IPRGA is the reverse algorithm of PRGA. This feature means that any formerRC4 state can be recovered from a later RC4 state by applying certain rounds IPRGA.Write code to implementboth the PRGA algorithm and following IPRGA algorithm and design and implement a way confirm that any RC4 state can go forward by PRGA and backward by IPRGA.IPRGA(S, i , j)Generation loop;S[i] ⟷ S[j]j←(j-S[i ] +256)mod 256i←(i -1)mod 256note 1.Source code and related documentation for part one are required .Please compress them into one zip file 2. Your related documentation should include introduction to your code, external comments, howto nun your code, and all screen shots of running your code, etc. Your source code shouldinclude the internal comments.