Question: Complete the following function void shape_keystream() in C void get_128_keystream_bits(char* ct,char* kpt){ FILE* ct_f = fopen(ct,r); FILE* fp = fopen(key_stream.txt,w); int i = 0; for(;i

Complete the following function void shape_keystream() in C

void get_128_keystream_bits(char* ct,char* kpt){

FILE* ct_f = fopen(ct,"r"); FILE* fp = fopen("key_stream.txt","w"); int i = 0; for(;i<16;i++) { unsigned char ctc = getc(ct_f); unsigned char b = ctc^kpt[i]; //fprintf(stderr,"%d ",b); int j = 7; for(;j>=0;j--){ int bit = parity(b & (1<

}

>>>>>> void shape_keystream() { /* This function opens the file "key_stream.txt" created by get_128_keystream_bits(). It uses this data to create a file called "S.mat.sage" which is a 64x64 ix of keystream bits of the form discussed in the project description. It also creates a vector (a 64x1 matrix) of keystream bits of the form described in the project description. This is stored in a file called "V.mat.sage" */

//See the file matrix.sagews for examples of what the output should look like.

/*You implement this*/

}

<<<<<<<<<<

int main() { LFSR L; uint64_t initial_state = 0xbeefcafebabecab1; uint64_t taps = 0xdeaddeedacedface; init_LFSR(&L,initial_state,taps); encrypt("toy_pt.txt","ct.txt",&L); init_LFSR(&L,initial_state,taps); decrypt("ct.txt","toy_ot.txt",&L); //get_128_keystream_bits("target_ciphertext",""); //shape_keystream(); }

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!