Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I believe I understand the idea behind this but I don't understand how swapping elements in a vector could expand it, such as in sections

I believe I understand the idea behind this but I don't understand how swapping elements in a vector could expand it, such as in sections 3 and 5 or how replicating v[3] and v[4] in section 4 would result in an 8 bit vector.

1. Store the following binary number as a character string s: 110011.

2. Convert this into a character vector v.

3. Expand the character vector v to 8 bits as follows: swap v[3] and v[4] .

4. Replicate v[3] and v[4] . The result (call it ev) should be a character vector of size 8.

5. Write a function called expand() that takes a binary vector of size 6 as input and returns a binary vector of size 8 as output.

6. Create two character vectors S11 and S12 such that S11 contains the binary representations of the numbers (5,2,1,6,3,4,7,0), and S12 contains those of the numbers (1,4,6,2,0,7,5,3).

7. Let b=1101. Extract the last three characters. Convert the last three characters into decimal and store it in a variable called tempVal. Write an if-then-else statement such that if b[1] == 0 retrieve the value of S11[tempval]. If b[1]==1 retrieve the value of S12[tempval] and store it in a variable tempRet. (Hint: You might need to shift the indices by 1)

8. Write a function called S11_function that takes a block of 4-character binary (such as 1110) and, using the two s-boxes from question 6, returns a 3-character binary number using the logic that if the first character is 0 then use S11, otherwise use S12.

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

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 1 Lncs 13426

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124227, 978-3031124228

More Books

Students also viewed these Databases questions