History homework help. code in R and submit your script and results for each of the following.  Use the functions expand() and S1_function() to do the following:1.    form second function for substitution box S2_function() that replicates the S1_function()  your wrote for homework 4 except that it uses the following substitution boxes: S11 contains the binary of the numbers (4, 0, 6, 5, 7, 1, 3 2) and S12 contains those for (5, 3, 0, 7, 6, 2, 1, 4). (20 points)2.    form a round function called round1() that takes a binary character vector of length 12 and key K of length 9 and does the following: (20 points total)a.    Divide the block into two equal halves called L0 and R0. b.    Create two sub keys K1 containing the first 8 digits of K and K2 that contains the last 8 digits of K.c.    Expand R0 from 6 t o 8 bits and call it ER0.d.    Take the XOR of the result of ER0 with K1. Store the first 4 bits in a variable called block1 and the last 4 bits in a variable called block2.e.    Call S1_function with block1 as its parameter.f.     Call S2_function with block2 as its parameter.g.    Concatenate the results of e) and f) and store the result in a variable called FR0.h.    Take the XOR of FR0 and L0 and store the results in R1.i.     Store R0 to L1.j.     Return L1 concatenated to R1.3.    form a second function called round2() that is similar to round1()  except that it uses K2 and returns the concatenation of R2 and L2.4.    Encrypt the message” “Wire $2000 to Bob” using the functions you wrote above following the simplified DES discussed in the class.5.    Modify the functions round1() and round2()  such that they can be used for decryption. [Hint: for decryption use K2 instead of K1 for round1() and K1 instead of K2 for round2(). Use a third parameter in the two functions round1() and round2() to indicate whether you are encrypting or decrypting].

History homework help