Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write your code in R and submit your script and results for each of the following. Use the functions expand() and S1_function() to do

Please write your 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:

Create a 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)

Create 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)

Divide the block into two equal halves called L0 and R0.

Create two sub keys K1 containing the first 8 digits of K and K2 that contains the last 8 digits of K.

Expand R0 from 6 t o 8 bits and call it ER0.

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.

Call S1_function with block1 as its parameter.

Call S2_function with block2 as its parameter.

Concatenate the results of e) and f) and store the result in a variable called FR0.

Take the XOR of FR0 and L0 and store the results in R1.

Store R0 to L1.

Return L1 concatenated to R1.

Write a second function called round2() that is similar to round1() except that it uses K2 and returns the concatenation of R2 and L2. (20 points)

Encrypt the message Wire $2000 to Bob using the functions you wrote above following the simplified DES discussed in the class. (20 points)

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]. (20 points)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual Basic 4 Ole Database And Controls Superbible

Authors: Michael Hatmaker, C. Woody Butler, Ibrahim Malluf, Bill Potter

1st Edition

1571690077, 978-1571690074

More Books

Students also viewed these Databases questions