Submit a Python program called assignment1.py based on SymPy with the following menu: A. Primality Test...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Submit a Python program called assignment1.py based on SymPy with the following menu: A. Primality Test using Miller-Rabin B. Chinese Reminder Theorem C. Symmetric Encryption D. Exit The behaviour of each of these menu options should be as follows: A. Miller-Rabin [30%]. Under this option, the program takes as input from the console an integer number n < 10,000, and uses the Miller-Rabin algorithm, as described in the course notes, to determine whether n is prime or not. The program should output the result of every iteration of the loop in the Miller-Rabin algorithm, and finally whether the number is prime or not. Of course, SymPy has the mr function available but this assignment is asking you to code the algorithm from scratch. B. Chinese Reminder Theorem [30%). Under this option, the program takes as input from the keyboard positive integers a, b, and c, and also pairwise relatively prime positive integers r, s, and t (i.e., gcd(r, s) = gcd(s, t) = gcd(r, t) = 1). The program should find the value of x that satisfies a system of congruencies of the form: x = a (mod r) x = b (mod s) x = c (mod t) You may use SymPy functions such as crt and others. C. Symmetric Encryption in Python [30%]. Under this option, the program takes as input from the keyboard a plaintext message and encrypts the message using either AES or 3DES encryption. The program automatically generates the necessary key, and outputs the corresponding ciphertext on the screen along with its decryption back to the original plaintext and the key used for encryption. Feel free to use example code from: https://cryptography.io/en/latest/hazmat/primitives/symmetric-encryption/. Submit a Python program called assignment1.py based on SymPy with the following menu: A. Primality Test using Miller-Rabin B. Chinese Reminder Theorem C. Symmetric Encryption D. Exit The behaviour of each of these menu options should be as follows: A. Miller-Rabin [30%]. Under this option, the program takes as input from the console an integer number n < 10,000, and uses the Miller-Rabin algorithm, as described in the course notes, to determine whether n is prime or not. The program should output the result of every iteration of the loop in the Miller-Rabin algorithm, and finally whether the number is prime or not. Of course, SymPy has the mr function available but this assignment is asking you to code the algorithm from scratch. B. Chinese Reminder Theorem [30%). Under this option, the program takes as input from the keyboard positive integers a, b, and c, and also pairwise relatively prime positive integers r, s, and t (i.e., gcd(r, s) = gcd(s, t) = gcd(r, t) = 1). The program should find the value of x that satisfies a system of congruencies of the form: x = a (mod r) x = b (mod s) x = c (mod t) You may use SymPy functions such as crt and others. C. Symmetric Encryption in Python [30%]. Under this option, the program takes as input from the keyboard a plaintext message and encrypts the message using either AES or 3DES encryption. The program automatically generates the necessary key, and outputs the corresponding ciphertext on the screen along with its decryption back to the original plaintext and the key used for encryption. Feel free to use example code from: https://cryptography.io/en/latest/hazmat/primitives/symmetric-encryption/.
Expert Answer:
Answer rating: 100% (QA)
python program Python program MillerRabin primality test import random Utility function to do modula... View the full answer
Posted Date:
Students also viewed these programming questions
-
An experiment was performed to determine whether there is an accumulation of heavy metals in plants that were grown in soils amended with sludge and whether there is an accumulation of heavy metals...
-
A study was made to determine whether there is a difference between the proportions of parents in the states of Maryland (MD), Virginia (VA), Georgia (GA), and Alabama (AL) who favor placing Bibles...
-
A manufacturing company wants to determine whether there is a difference between the variance of the number of units produced per day by one machine operator and the similar variance for another...
-
Prepare budgetary and proprietary journal entries to record the following year- end adjustments: 1. An accrual of $ 60,000 was made for salaries earned the last week of September, to be paid in...
-
Refer to the financial statements for Lynch Shoes Inc. in Problem 12-78A and the following data. Required: 1. Prepare all the financial ratios for Lynch for 2011 and 2010 (using percentage terms...
-
If the coefficient of static friction at the contact points A and B is ? s = 0.4, determine the minimum distance d where a 75-lb girl can stand on the plank without causing it to slip. Neglect the...
-
In Example 8.1, the mosquito has an inertia of \(0.1 \mathrm{~g}\) and is initially at rest, while the bus, with an inertia of \(10,000 \mathrm{~kg}\), has an initial speed of \(25 \mathrm{~m} /...
-
Sprague Company Ltd. publishes a monthly sports magazine, Fishing Preview. Subscriptions to the magazine cost $28 per year. During November 2012, Sprague sells 6,300 subscriptions for cash, beginning...
-
26 The number of protons, neutrons, electrons in some particles are shown in the table below Particle Protons Neutrons electrons P 1 1 2 Q 2 2 2 R 3 4 2 T 4 5 4 Which one of the following particles...
-
1. East Coast Yachts uses a small percentage of preferred stock as a source of financing. In calculating the ratios for the company, should preferred stock be included as part of the companys total...
-
Cullumber Company uses a periodic inventory system and reports the following for the month of June. Date Explanation Units Unit Cost Total Cost June 1 Inventory 130 $5 $ 650 12 Purchases 388 6 2,328...
-
What is the big-Oh time estimate of the following method in terms of n, the length of a? Use the light bulb pattern method of Section 14.7 to visualize your result. public static void swap (int[] a)...
-
Suppose we modified the selection sort algorithm to start at the end of the array, working toward the beginning. In each step, the current position is swapped with the minimum. What is the result of...
-
Repeat Exercise P18.1 but require that the array elements implement the Comparable interface. Data from exe rcise P 18.1 Write a static generic method PairUtil.minmax that computes the minimum and...
-
Suppose you buy 100 shares of a stock at $12 per share, then another 100 at $10 per share, and then sell 150 shares at $15. You have to pay taxes on the gain, but exactly what is the gain? In the...
-
Implement an inorder method for the BinaryTree class of Section 17.2 so that it stops visiting when the visit method returns false. ( Have inorder return false when visit returns false.)
-
British antitrust regulators dealt a major setback on Wednesday to Microsoft's plans to acquire the video game giant Activision Blizzard for $69 billion, blocking the proposed deal and handing a...
-
An investor sells a European call on a share for $4. The stock price is $47 and the strike price is $50. Under what circumstances does the investor make a profit? Under what circumstances will the...
-
See the option quote on IBM from the CBOE Web site on the next page showing options expiring in March and April 2022. a. Which option contract had the most trades that day? b. Which option contract...
-
Two European call options with a strike price of \($50\) are written on two different stocks. Suppose that tomorrow, the low-volatility stock will have a price of \($50\) for certain. The...
-
It is February 21, 2022, and you have decided to purchase 10 June call contracts on eBays stock with an exercise price of \($57.50.\) Because you are buying, you must pay the ask price. How much...
Study smarter with the SolutionInn App