Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

FIN446 – ASSIGNMENT 1

1. Using the SHA 256 hash calculator at https://emn178.github.io/online-


tools/sha256.html:

(a) Find the hash of an input string that is your name followed by a random 10
digit number (the “nonce”).

ShrutiMishra0000000000
19bcf8b7776778a39d6f71a2e55fd981e0185d34087d82d3d6313c81abcdc525

(b) Modify the 10 digit nonce in any way so that the resulting hash begins with
‘00’(Note: you will have to randomly make changes. This calculator shows you
instant updating so that you can go right across the nonce changing 10 digits in a
row then go back to the beginning and try different nonces)

ShrutiMishra000020028 
00c46a071d1ddf5ece598f3c4f492aef4613c40e866a2608065dc348fdb0a550

(c) How many attempts (on average) should be required to achieve the result in
part (b)? Explain
As each digit of the nonse can be converted into binary (0 or 1), the 10 digits of
the nonse would create 2^10 combinations = 1024 combinations. Worst case, a
total of 1024 attempts might be required, thus on an average about 500 attempts
should help achieve the result.

2. Using the 20 bit hash function, Hash FIN446, complete the following:

(a ): Enter the payment contract below in the 60 character Hash FIN446 field
(replacing the name field with your name) and find the hash result:

I will pay Shruti Mishra $.01 on 4/4/20.

Hash- B7544

(b ): Modify the payment contract dollar amount so that it pays a large sum of money
(any size, including commas, decimals, etc.) but has the same Hash result. [Note: this
can be solved by trial and error – but it might be easier to look at what the hash
function is doing and making appropriate changes.]

New text – I will pay Shruti Mishra $999111111110110100203000 on 4/4/20.

3. Assume you are working with a blockchain for a cryptocurrency that has the following
structure:
(a) If the hash function was weak (like Hash FIN446) and you wanted to change the
details of a transaction in the Block Data of Block01, what would be the simplest way to
make the change and have it not be noticed going forward? Explain.

The easiest way would be to pad extra characters at the end of the new block data and
manipulate the hash function to generate the original hash. That way, the next block
views the hash code of the previous block in line with the expected hash code and doesn’t
trigger a failure.

(b) If full versions of this blockchain (including all transactions) are distributed to 1,000
full user nodes who are all competing to “mine” new blocks to put on the chain, will your
change in part (a) be successful? Explain. [Note: Assume that approval of at least 10
“miners” is required for new transactions spending cryptocurrency currently recorded on
the blockchain]

If 1000 users are all trying to mine new blocks and atleast 10 miners need to approve the
transaction, the process essentially becomes a race where 1000 people and their
computers are trying out different nonces one after the other to meet/generate the
requisite hash code. If any one of the 1000 users identify the nonce before me and that
gets approved by the users, the block that was being mined changes and the whole nonce
identification process starts from the beginning. Adding to this complexity is the fact that
10 different users would have to approve the change, thus, the change would need to be
made in enough copies of the data to ensure the users can obtain consensus to approve the
change that’s been made. This would lead to my changes not getting accepted and the
efforts in mining the nonce getting wasted.

You might also like