Question: Please solve it in python code and the student ID is 4 5 5 2 3 6 9 7 . In this question, we will
Please solve it in python code and the student ID is In this question, we will see how they work in practice. This question requires programming in a language that has an implementation of SHA hash function. You should use pythons hashlib for this purpose. Let t
Suppose solving the hash puzzle for the current block requires you to find a nonce r an integer greater or equal to such that H strs k str k strr t
Here H is the SHA hash function. The function str is the string function, ie given any integer s the function strs casts it into a string. For example s becomes strs The symbol k denotes string concatenation. Suppose s is your student ID Your strategy is to try successive values of r starting from until the SHA of the string above falls below the target value, ie until you solve the puzzle.
a Implement a program that tries successive values of r ie r computes H strs k str k strr compares it with t and halts whenever it is less than t with the output r You need to provide the program and the output r
b If the value of s is different every time a new block is to be formed, what is the expected value of r before your code will find the target and why?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
