Name______________________
Score: _____ / 24
CPSC 42500 Homework 4: AES, Cryptanalysis, Padding, and
Modes of Operation
1. (2 pts) Why is AES256 considered more secure than AES128, even though the block size is
the same (128 bits) in both cases?
2. (3 points) You may use Wikipedia to look up the factual part of the answers (the calculation
part you can do yourself.)
a. What is the time complexity for a biclique attack on AES192?
b. How many times faster than brute force is that? Be exact.
c. What is the current best time complexity for a relatedkey attack on all rounds of
AES192?
3. (3 pts) Consider the padding method described in class, in which the plaintext is padded to
the next block boundary with bytes whose value is the binary representation of the number n
of padding bytes needed.
In a 128bit (16byte) block cipher, if a message is 48 bytes long, how many padding bytes
would you need to add? Describe why this is necessary.
For the remaining questions, consider a 4bit block cipher, described in hexadecimal by the
following table:
Plaintext Ciphertext Plaintext Ciphertext
0
a
8
e
1
c
9
d
2
f
a
0
3
6
b
7
4
3
c
5
5
8
d
b
6
4
e
9
7
2
f
1
You can think of this as a simple substitution cipher for hexadecimal digits. There is no “key”
other than the table itself.
4. (4 pts)
a. Encrypt the 4block message cafe using this cipher for each digit individually.
b. Decrypt the ciphertext b99b using this cipher.
c. Why is it insecure to use a block cipher in this way? Do not critique the block cipher
itself, but only how it is used.
5. (6 pts) For this question, you will perform encryption and decryption using the same cipher
described above, but in CBC mode. Recall that you can convert hexadecimal digits to binary
to do the XOR operation.
a. Encrypt the 4block message dea1 using the above block cipher in CBC mode with
an IV of 6 (0110 in binary).
b. Decrypt the ciphertext db70 using the above cipher in CBC mode with an IV of 6.
6. (6 pts) For this question, you will perform encryption and decryption using the same cipher
described above, but in CTR mode.
a. Encrypt the message dea1 using the above block cipher in CTR mode, with a counter
that starts from 0. (Don’t use any IV.)
b. Decrypt the ciphertext 5628 using the above block cipher in CTR mode, with a
counter that starts from 0. (Don’t use any IV.)
c. Was this easier or more difficult than encrypting/decrypting in CBC mode? Do you
suspect any difference in security? Why or why not?
Polynomial Plotter
Due Monday, February 22
27 points
In this assignment, you will enable the user to define polynomials and then calculate their
values over a domain specified by the user. It will tabulate the values of each polynomial over
that domain.
Your program will begin by printing an attractive header that reads “Polynomial Plotter”
centered across the screen.
It will then ask the user for the degree of the polynomial they want to calculate. The degree of a
polynomial is its highest exponent. For example, this polynomial has degree 4:
𝑓(𝑥) = 7𝑥 4 − 3.2𝑥 3 + 7𝑥 2 + 5.1𝑥 + 12
Once your program knows the degree of the polynomial the user wants to calculate, it should
ask the user for the coefficients of the terms that are relevant for that degree. For example, if
the user wants to calculate a 4th degree polynomial, you should ask for the term of the x4, x3, x2,
x, and constant terms. If the user wants to calculate a 2 nd degree polynomial, it should ask for
only the x2, x, and constant terms. The maximum degree your program must handle is 4.
After the program asks for the coefficients of the polynomial, it should ask for the domain over
which to calculate the values of the function. In other words, it should ask for the minimum and
maximum value of x to plug into f(x).
Now that it knows the degree, relevant coefficients, and domain, calculate the value of f(x) for
all the integers in the domain. For example, if the user indicated they wanted the domain to be
[3, 3], plug the values 3, 2, 1, 0, 1, 2, and 3 in for x in the function and calculate the resulting
values. Hint: use a for loop for this.
Print the values of x and y in a nicely formatted table where the values line up appropriately, as
shown in the output below.
Repeat these tasks for as long as the user wants to calculate another polynomial. Simply ask
them if they’d like to enter another function. If they do, repeat. If they don’t, bid adieu, and end
the program.
Here is how your program will be graded:
Points
Accomplishment
2
Nicely formatted and centered heading like the one in the sample output
6
Ask the user for the degree of the polynomial and then for the correct, relevant
coefficients and the min and max x values
3
You print the line “Here is f(x) =” followed by the coefficient of the correct degree
and coefficients and the domain expressed as [xmin, xmax].
You calculate the value of f(x) over the specified domain correctly
You present the results nicely in a table with boundaries and with the headings
“x” and “f(x) centered atop each column
You ask the user if they’d like to enter another polynomial and repeat the process
if they do and end the process if they do not.
You sprinkle helpful comments throughout your code, including ones that show
your name and the purpose of the program at the top
You submit your program to blackboard with the name
“lastname_polynomial.py”
6
3
3
2
2
Sample output follows.
**********************************************************************
*
POLYNOMIAL PLOTTER
*
**********************************************************************
Enter
Enter
Enter
Enter
Enter
Enter
Enter
the
the
the
the
the
the
the
degree of the polynomial (1, 2, 3, or 4): 3
coefficient of the x^3 term: 1
coefficient of the x^2 term: 2
coefficient of the x term: 3
constant: 4
starting value of x: 8
ending value of x: 8
Here is f(x) = 1.00x^3 + 2.00x^2 + 3.00x + 4.00 over domain [8,8]:
*—————–*

x

y

—————–

8.00 404.00

7.00 262.00

6.00 158.00

5.00 86.00

4.00 40.00

3.00 14.00

2.00
2.00

1.00
2.00

0.00
4.00

1.00
10.00

2.00
26.00

3.00
58.00

4.00 112.00

5.00 194.00

6.00 310.00

7.00 466.00

8.00 668.00
*—————–*
Do you want to try another (y or n)? y
Enter the degree of the polynomial (1, 2, 3, or 4): 4
Enter
Enter
Enter
Enter
Enter
Enter
Enter
the
the
the
the
the
the
the
coefficient of the x^4 term: 0.5
coefficient of the x^3 term: 3
coefficient of the x^2 term: 4.5
coefficient of the x term: 12
constant: 15
starting value of x: 8
ending value of x: 8
Here is f(x) = 0.50x^4 + 3.00x^3 + 4.50x^2 + 12.00x + 15.00 over domain [8,8]:
*—————–*

x

y

—————–

8.00 113.00

7.00 148.00

6.00 249.00

5.00 250.00

4.00 199.00

3.00 132.00

2.00 73.00

1.00 34.00

0.00 15.00

1.00
4.00

2.00
23.00

3.00 102.00

4.00 281.00

5.00 620.00

6.00 1191.00

7.00 2078.00

8.00 3377.00
*—————–*
Do you want to try another (y or n)? y
Enter the degree of the polynomial (1, 2, 3, or 4): 2
Enter the coefficient of the x^2 term: 0.25
Enter the coefficient of the x term: 7
Enter the constant: 12
Enter the starting value of x: 8
Enter the ending value of x: 8
Here is f(x) = 0.25x^2 + 7.00x + 12.00 over domain [8,8]:
*—————–*

x

y

—————–

8.00 28.00

7.00 24.75

6.00 21.00

5.00 16.75

4.00 12.00

3.00
6.75

2.00
1.00

1.00
5.25

0.00
12.00

1.00
19.25

2.00
27.00

3.00
35.25

4.00
44.00

5.00
53.25

6.00
63.00

7.00
73.25

8.00
84.00
*—————–*
Do you want to try another (y or n)? y
Enter the degree of the polynomial (1, 2, 3, or 4): 1
Enter the coefficient of the x term: 2
Enter the constant: 5
Enter the starting value of x: 12
Enter the ending value of x: 12
Here is f(x) = 2.00x + 5.00 over domain [12,12]:
*—————–*

x

y

—————–
 12.00 19.00
 11.00 17.00
 10.00 15.00

9.00 13.00

8.00 11.00

7.00
9.00

6.00
7.00

5.00
5.00

4.00
3.00

3.00
1.00

2.00
1.00

1.00
3.00

0.00
5.00

1.00
7.00

2.00
9.00

3.00
11.00

4.00
13.00

5.00
15.00

6.00
17.00

7.00
19.00

8.00
21.00

9.00
23.00

10.00
25.00

11.00
27.00

12.00
29.00
*—————–*
Do you want to try another (y or n)? n
Thank you for using this program.
…
Purchase answer to see full
attachment
Our customer is the center of what we do and thus we offer 100% original essays..
By ordering our essays, you are guaranteed the best quality through our qualified experts.All your information and everything that you do on our website is kept completely confidential.
Academicwritingcompany.com always strives to give you the best of its services. As a custom essay writing service, we are 100% sure of our services. That is why we ensure that our guarantee of moneyback stands, always
Read moreThe paper that you order at academicwritingcompany.com is 100% original. We ensure that regardless of the position you are, be it with urgent deadlines or hard essays, we give you a paper that is free of plagiarism. We even check our orders with the most advanced antiplagiarism software in the industry.
Read moreThe Academicwritingcompany.com thrives on excellence and thus we help ensure the Customer’s total satisfaction with the completed Order.To do so, we provide a Free Revision policy as a courtesy service. To receive free revision the Academic writing Company requires that the you provide the request within Fifteen (14) days since the completion date and within a period of thirty (30) days for dissertations and research papers.
Read moreWith Academicwritingcompan.com, your privacy is the most important aspect. First, the academic writing company will never resell your personal information, which include credit cards, to any third party. Not even your lecturer on institution will know that you bought an essay from our academic writing company.
Read moreThe academic writing company writers know that following essay instructions is the most important part of academic writing. The expert writers will, therefore, work extra hard to ensure that they cooperate with all the requirements without fail. We also count on you to help us provide a better academic paper.
Read more