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 are junk bonds? Would you ever recommend the purchase of them?
-
Evaluate the following statement made by Henry Theil:* Given the present state of the art, the most sensible procedure is to interpret confidence coefficients and significance limits liberally when...
-
A double acting piston pump runs at 90 rpm. Its bore and stroke are 150 mm and 450 mm respectively. Determine the theoretical discharge in m3/h. If the total head to be lifted by the pump is 60 m,...
-
Russian is an Indo-European language of the Slavic family, spoken in Russia. Determine from the following Russian data whether the low front [a] and the low back [a] complement each other as...
-
(a) What is the kinetic energy in joules of a 1140-kg automobile traveling at 93 km/h? (b) How much work would have to be done to bring a 1140-kg automobile traveling at 93 km/h to a stop? 4. How...
-
7. 8. 9. An experiment is conducted using a fin as shown below. Temperature readings are collected along the length of the fin, which is made from copper with k-400W/m.K. Tb=50C x1 X L = 0.5m x2 h x3...
-
Placid Lake Corporation acquired 90 percent of the outstanding voting stock of Scenic, Incorporated, on January 1, 2023, when Scenic had a net book value of $550,000. Any excess fair value was...
-
Suppose you were the agent for Ralph Boomer Smith, the punter for the Los Angeles Rams. Explain how you could use the mean yards and standard deviation for Boomers punts to argue for a pay increase...
-
Comment on the following statement: Investors dont care about the variability of a stocks returns, because they have the same chance of falling below the median as above the median. Therefore, on...
-
When a distribution is skewed to the right, which measure of central tendencythe mean, median, or modehas the highest value? Which has the lowest value?
-
The final scores from an honors seminar in marketing were 65 55 70 80 90 100 50 75 Find the mean, median, and mode. Is one measure preferable to another. Why or why not?
-
Compare the use of the mean to the use of the median as a measure of central tendency. If you were taking a tough calculus class where 3 brilliant students out of 20 nevertheless received perfect...
-
Explain the DSM system architecture.
-
7 A 29-year-old, previously healthy man suddenly collapses at a party where legal and illicit drugs are being used. Enroute to the hospital, he requires resuscitation with defibrillation to establish...
-
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...
-
Using a financial calculator, solve for the unknowns in each of the following situations. a. On June 1, 2024, Holly Golightly purchases lakefront property from her neighbor, George Peppard, and...
-
Sally W. Emanual, a teacher, had the following dividends and interest during 2022: Additional information pertaining to Sally Emanual includes The taxable portion of the pension is \($7,000.\) Sally...
-
Ed owns Oak Knoll Apartments. During the year, Fred, a tenant, moved to another state. Fred paid Ed \($1,000\) to cancel the two-year lease he had signed. Ed subsequently began renting the unit to...
Study smarter with the SolutionInn App