Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

#include <stdio.h> #include <stdint.h> #include <assert.h> typedef uint8_t byte;

ID: 3872887 • Letter: #

Question

#include <stdio.h> #include <stdint.h> #include <assert.h>

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<=256); int i; for(i = 0; i < 256; 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 < 256; 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 < len; i++) { text[i] = rc4CryptByte(state, text[i]); } } #include <stdio.h> #include <stdint.h> #include <assert.h>

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<=256); int i; for(i = 0; i < 256; 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 < 256; 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 < len; 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

Explanation / Answer

step 1: first copy the program code u want to run in visual studio.

step 2: then goto the visual studio and open it.

step3: then click on new project.

step4;it will show a menu of options such as windows applications etc., as shown below.

step 5: then see the left side options if there as an visual c++ click on it. otherwise goto other languages click on it .

step 6:on clicking on other languages a drop down menu arises there u can see visual c++.

step 7:on clicking visual c++ there arises a drop down menu there u have to choose general option.

step 8: on choosing general we will see a menu on right side large window there u should choose empty c++ program.

step 9: on choose empty c++ program below u should enter the c++ program name and click ok at below bottom of the panel.

step 10:clicking on ok a working environment arises there on right side u can see a menu of options.

step 11: in that menu u should choose the source code option and right click on it.

step 12:there gives another menu on that choose add.

step 13:on choosing add another menu arises than choose "new item".

step 14: on choosing new item there gives menu choose c++ program or header file according to ur choice.

step 15: according options it displays a screen and now paste the code u have copied in step 1.

step 16: on copying click debug on the top menu on the screen.then after debugging solution is prepared and if there are errors it will arise a pop up there are errors r u wish to continue with the code than chosse no and rectify the errors.

step 17:if there are no errors than thesolution is build succesfully it displayed below and now choose the play button on top of the screen.

step 18:on choosing play u will get the output screen.hence c++ progrom is run successfully on the visual basic.