Question: Please write your code in R and submit your script and results for each of the following. Note that R does not accept 0 as

Please write your code in R and submit your script and results for each of the following. Note that R does not accept 0 as an index for a vector. So every vector starts with 1.

4. Fill three variables x, y, and z with the results of 3 such that x gets the first 19, y gets the next 22, and z gets the last 23 bits. Initialize an integer vector k of length 128.

5. Find the majority value for x[9], y[11] and z[11].

6. Write code for the following: if x steps then shift x to the right by 1 bit. Next assign the appropriate value to x[1]. Do the same for y and z.

7. Create key stream bit by XOR-in the appropriate bits from x, y, and z vectors.

8. Write a function for the above and create a 128 bit key stream with the seed mentioned in question 3. You function should contain two parameters: a seed and a key length.

9. Create an integer vector S with values from 1-5. Swap elements 1 and 4. [Hint: use the swap() function in package seqinr.

10. Implement RC4 for generating key streams. You function should contain two parameters: a seed and a key length.

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!