Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Need Help Urgently-My Final Project in 2 Days

Status
Not open for further replies.

nick_533

Junior Member level 3
Junior Member level 3
Joined
Mar 29, 2006
Messages
26
Helped
0
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
1,515
2 The RC4 Algorithm
The RC4 algorithm employs a variable-length key, K, ranging from 8 to 2048 bits and a 256-byte state vector, S. The algorithm needs to be initialised as described in algorithm 1 before encryption/decryption can take place.

Algorithm 1 RC4 initialization
{Initialization of S}
for i =0 to 255 do
Si<-i
Ti<-K(i mod 2power8)base
end for
{Initial permutation of S}
j <-0
for i=0 to 255 do
j<-(j+Si+Ti)mod 2power8
Si<-Sj,Sj<-Si {Swap Si and Sj}
end for

Each iteration of the stream generator results in a single byte value, k, which is the used to perform the XOR operation with the cipherstream or plaintext stream for decryption or encryption respectively.

Algorithm 2 RC4 Stream Generation
i,j<-0,0
loop
i<-(i+1)mod 2power8
j<-(j+Si)mod 2power8
Si<-Sj,Sj<-Si {Swap Si and Sj}
t <-(Si+Sj)mod 2power8
k<-St
end loop

Exercises
Exercise 1: Implement the RC4 algorithm in the programming language of your choice.A Sample data
You can use the following information to test your implementation.
Key: abcdefghijklmnopqrst
Plaintext 0x49 0x54 0x53
RC4 stream 0x39 0xE8 0x32
 

THis is easy. I would start if yyou have two days left :).
 

If you just do a search on RC4, you can find quite a few usable hits. And the pseudo code as stated, can be rewritten in Pascal without much difficulty, it seems.

A word of warning: be careful no to copy .src from the internet as-is since teachers can search and find the same code, too. ;)
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top