Question: #include #include #include typedef uint8_t byte; typedef struct { byte i, j; byte S[256]; } Rc4State; void swap(byte *a, byte *b) { byte temp =

 #include #include #include typedef uint8_t byte; typedef struct { byte i,
#include
#include
#include
typedef uint8_t byte;
typedef struct
{
byte i, j;
byte S[256];
} Rc4State;
void swap(byte *a, byte *b)
{
byte temp = *a;
*a = *b;
*b = temp;
}
/*Initialization & initial permutation
also initialize i&j counters in state for stream generation*/
void initState(const byte K[256], int keylen, Rc4State *state)
{
byte T[256];
assert(keylen>=1 && keylen
int i;
for(i = 0; i
state-> S[i] = i;
T[i] = K[i % keylen];
}
//Initial permutation of S
byte *S = state->S;
int j = 0;
for(i = 0; i
j = (j + S[i] + T[i]) % 256;
swap(&S[i], &S[j]);
}
//Initialize counters in state
state->i = state->j = 0;
}
/*Encrypt/Decrypt text by XORing with next byte of keystream*/
byte crypt(byte text, Rc4State *state)
{
byte t, k;
byte *i = &(state->i), *j = &(state->j);
byte *S = state->S;
*i = (*i+1) % 256;
*j = (*j+S[*i]) % 256;
swap(&S[*i], &S[*j]);
t = (S[*i] + S[*j]) % 256;
k = S[t];
return text ^ k;
}
static byte rc4CryptByte(Rc4State *state, byte plainText)
{
byte *S = state->S;
byte i = ++(state->i);
byte j = (state->j += S[i]);
swap(&S[i], &S[j]);
byte t = S[i] + S[j];
byte k = S[t];
return plainText ^ k;
}
void rc4Crypt(Rc4State *state, byte text[], size_t len)
{
for (size_t i = 0; i
{
text[i] = rc4CryptByte(state, text[i]);
}
}
This is a program
I am trying to run
But I do not know how to run
Can you explain me how to run with visual studio using step by step
How to set it up
Using Visual Basic
C++ thank u
It will help me a lot thank u
MetroPCS 10:48 AM * 57% Done program 1.txt include #include #include typedef uint8 t byte; typedef struct byte i, j byte S[256]; Rc4State; void swap(byte *a, byte *b) byte tempa; *a = *b; *b = temp ; /*Initialization & initial permutation also initialize i&j counters in state for stream generation/ void initState(const byte K[256], int keylen, Rc4State *state) byte T[256]; assert ( keylen>=1 && int i; for ( i = 0; i s [ i ] i ; //Initial permutation of S byte *S = state->S ; int j = 0; for ( i = 0; i j = 0; 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!