Recall hash puzzles from Lecture 10. In this question, we will see how they work in...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Recall hash puzzles from Lecture 10. In this question, we will see how they work in practice. This question requires programming in a language that has an implementation of SHA-256 hash function. You should use Python's hashlib for this purpose. Create an integer s containing all the digits in your student ID, followed by the current year, i.e., 2023. For example, if my student ID is 12345678, then s = 123456782023. Let "str" denote the string function, i.e., given any integer s. the function str(s) casts it into a string. For example, =123456782023 becomes str(s) = "123456782023". Set the target t to: 2256 26 Let H be the SHA-256 hash function. Let r be a counter starting from 1. Finally, let "|" denote string concatenation. 5 (a) Implement a program that tries successive values of r, ie., r = 1,2,3,.... computes H(str(r)||str(s)), compares it with t and halts whenever H(str(r)||str(s)) < t, with the output r. You need to provide the program and the output r. (5 marks) (b) Let us call the program from part (a) as: PuzzleFinder(s, t). Write a program that calls PuzzleFinder with successive inputs (s+i, t), for i=0 to 999, and records the output for each of these 1,000 runs. What is the average number of attempts in these 1,000 runs before you found the target? You need to provide your program. (3 marks) (c) If you want someone to take 260 attempts on average before they solve the puzzle, what should you set the target to and why? (2 marks) Recall hash puzzles from Lecture 10. In this question, we will see how they work in practice. This question requires programming in a language that has an implementation of SHA-256 hash function. You should use Python's hashlib for this purpose. Create an integer s containing all the digits in your student ID, followed by the current year, i.e., 2023. For example, if my student ID is 12345678, then s = 123456782023. Let "str" denote the string function, i.e., given any integer s. the function str(s) casts it into a string. For example, =123456782023 becomes str(s) = "123456782023". Set the target t to: 2256 26 Let H be the SHA-256 hash function. Let r be a counter starting from 1. Finally, let "|" denote string concatenation. 5 (a) Implement a program that tries successive values of r, ie., r = 1,2,3,.... computes H(str(r)||str(s)), compares it with t and halts whenever H(str(r)||str(s)) < t, with the output r. You need to provide the program and the output r. (5 marks) (b) Let us call the program from part (a) as: PuzzleFinder(s, t). Write a program that calls PuzzleFinder with successive inputs (s+i, t), for i=0 to 999, and records the output for each of these 1,000 runs. What is the average number of attempts in these 1,000 runs before you found the target? You need to provide your program. (3 marks) (c) If you want someone to take 260 attempts on average before they solve the puzzle, what should you set the target to and why? (2 marks)
Expert Answer:
Answer rating: 100% (QA)
Heres a Python program that implements the requirements described in parts a and b of the question python import hashlib def PuzzleFinders t r 1 while ... View the full answer
Related Book For
Financial Reporting Financial Statement Analysis and Valuation a strategic perspective
ISBN: 978-1337614689
9th edition
Authors: James M. Wahlen, Stephen P. Baginski, Mark Bradshaw
Posted Date:
Students also viewed these programming questions
-
What is the price of a 5% fixed rate coupon bond, $100 par value, which has 8 years to maturity given a market discount rate of 5.353%?
-
Jessica lives with her parents and attends the local state college. The local state college is operated by the state government, and tuition is free. Jobs that pay $10 an hour are available to high...
-
A lessor and a lessee sign a lease agreement under the following terms, duration 5 years at the beginning of the lease, an entity that is a distributor of industrial equipment purchased equipment for...
-
You firm needs to pay its British supplier 1,000,000. If the exchange rate is $1.61/, how many dollars will you need to pay the British supplier? OA. $1,000,000 OB. $621,118 c. $1,610,000 D. $385,787
-
What element has the lightest atoms?
-
Why was the Korean central bank unable to stop the decline in the value of the won?
-
The following financial information is known about Pfizer, Inc. for the year ended December 31, 2015. (all amounts in millions): yom a. The balance of cash and cash equivalents was \($3,641\). b....
-
Dillman Corporation has nexus in States A and B. Dillmans activities for the year are summarized below. Determine the apportionment factors for A and B assuming that A uses a three-factor...
-
Cash flows related to three mutually exclusive capital equipment projects are given in table below. Alternative Initial Cost Uniform annual Salvage Value $750 A $1000 $125 B $800 $120 $500 C $600...
-
Refer to the financial statements of The Home Depot in Appendix A at the end of this book. Required: 1. How much did The Home Depots sales revenue increase or decrease in the year ended January 29,...
-
Everyday investment company Sharesies was launched in February 2017, after conducting research on New Zealanders attitudes towards investing. Prior to launching the company, the co-founders...
-
(a) What actions did HP take to improve their IDC performance (a) by reducing the component devaluation cost and (b) by keeping price protection to a minimum? (b) How did the IDC measures link to...
-
Total production costs for Jordan, Inc. are budgeted at P2,300,000 for 50,000 units of budgeted output and P2,800,000 for 60,000 units of budgeted output. Because of the need for additional...
-
Benson Company established a predetermined fixed overhead cost rate of $24 per unit of product. The company planned to make 6,000 units of product but actually produced only 5,600 units. Actual fixed...
-
Some experts believe that the US government should not provide oversight of ethics in the field of healthcare. They believe that it should be left to the individual professions. On the other hand,...
-
Financial analysis of Wal-Mart (a) the working capital and explain their working capital strategybased on your findings; (b) Bonds, Bond Valuation, and return on Capital Assets and explain their bond...
-
The following table gives the expected returns and probabilities of various states of nature for securities A and B: A. B. C. State Probability Return on Asset A Return on Asset B Boom 0.10 45% 30%...
-
Which of the following is FALSE regarding the purchasing power parity (PPP). a. The PPP is a manifestation of the law of one price b. The PPP says that a country with a higher expected inflation can...
-
Assume that a company needs to acquire a large special-purpose materials handling facility. Given that no outside vendor exists for this type of facility and that the company has available...
-
Exhibit 6.18 presents selected financial statement data for Enron Corporation as originally reported for 1997, 1998, 1999, and 2000. In 2001, Enron restated its financial statements for earlier years...
-
The Coca-Cola Company is a global soft drink beverage company (ticker: KO) that is a primary and direct competitor with Starbucks. The following data for Coca-Cola include the actual amounts for 2015...
-
The Mann Corporation began operations in 2015.Information relating to the companys purchases of inventory and sales of products for 2015 and 2016 is presented below. Calculate the weighted-average...
-
Presented below is financial data for two companies that are identical yma in every respect except that Company X uses the FIFO method to value its inventory and Company Z uses the LIFO method to...
-
The following financial information is taken from the annual report of Intel Corporation: Using the above data, calculate the companys inventory turnover, inventory-on-hand period, and gross profit...
Study smarter with the SolutionInn App