Homework on Hash Functions - Questions

1- Hash functions are a mathematical functions (each unique input gives a unique output and it’s one way which mean you can’t go from output to figure out the input

2- Bitcoin blockchain uses hash algorithm to run it’s consensus mechanism, Bitcoin miners work to solve difficult mathematical equations, adding new blocks to the blockchain, these block are added following successful verification of the hashes.

3- Collision resistant means that two different types of inputs can’t give the same output.

1 Like
  1. Hash function is a linear and one-way function where one Input only leads to a unique Output. The reverse-path from deducting an Input from the Output is not possible.
  2. Bitcoin uses the SHA 256 function to secure its blockchain. Basically, to mine a block and earn rewards, a miner needs to produce a nonce that, after being hashed, is less than or equal to the previous hash from the most recent block accepted by the bitcoin network. This number is between 0 (min) and 256-bits (max). The miner then needs to test a large number of values before being successful. An unsuccessful miner has to wait for the next block.
  3. In cryptography, collision resistance is a property of cryptographic hash functions: a hash function H is collision-resistant if it is hard to find two inputs that hash to the same output; that is, two inputs a and b where a ≠ b but H(a) = H(b).
1 Like
  1. With a Hash Function each unique input gives a unique output, like a digital fingerprint. So if you change something in the input, you’ll see that the output is changing too.
    A Hash Function is a one way function, because you can only go from input to output and not the other way around.

  2. In the bitcoin protocol the Hash Functions are used to write new transaction in the blockchain through the mining process.

  3. Collision resistant means that two different inputs shouldn’t have the same output as a result. With Hash Functions every unique input should have a unique output, that’s why it needs to be collision resistant.

1 Like
  1. Describe hash functions with your own words

They work by taken data like this sentence for example and giving a unique output in bitcoins case it would the the secure hashing algorithm SHA-256. How long it depends on the base level. If I understood correctly in your video SHA-256 is base 16. Meaning it uses 0-9 as numbers in the output so 10 variables , and letters a-f another 6 variables getting us to the base 16.

  1. How are hash functions used in cryptocurrencies like bitcoin?

They take input ie bitcoin sent , so lets say I send 1 bitcoin to someone then the network then begins by taking the blockheader for that transaction and making a fingerpint equal to or less than the “target hash”. If the target hash is 18 it means the network participants must take the blockheader for the transaction of 1 bitcoin I mentioned before and play with the nounce of 4 byte field it using (numbers it using to reach hash target) and change it till we hit our target hash of 18. Whoever takes that blockheader for the 1 btc transaction (input) and reaches the target hash of 18 (number of zeros at the start of the output) will mine that block ie solve for hash target and get the block reward. Every 2016 blocks added (proof of work block solved via reaching our hash target meaning input gets desired output in this case the target hash of 18) the target hsah will be recalculated.

  1. What does it mean when we say that hash functions need to be collision resistant?

It must be impossible to have two different inputs and reach same output. So if put it as a input 1 my output is ‘1’ 6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b , I should’nt be able to put in a ‘2’ and get 6b86b273ff34fce19d6b804eff5a3f5747ada4eaa22f1d49c01e52ddb7875b4b .

1 Like
  1. Hash function is a function that takes an input of any size or style data and fits them into another unique output data structure. Like a digital finger print.
  2. Many things from obtaining public keys to block signatures etc.
  3. Hash functions with more inputs then outputs will have collisions. So hash functions that are collision resistant mean, "if it is hard to find two inputs that hash to the same output.
1 Like
  1. The hash function is an algorithm where you give an input and it gives you a specific out. The same input will always give you the same output. If there is any change made the output will be completely different. There is no way to know the input if all you have is the output. It is a one way function.

  2. They are used for two main reasons. The first is to produce a public key. The second is in bitcoin mining. A block of unconfirmed transactions are fed into a hash function. The output is called a hash digest.

  3. Collision resistance means it should be almost impossible to find 2 inputs that produce the same output.

1 Like
  1. Describe hash functions with your own words

Hash functions take the input to create an output and give it a specialized digital fingerprint.

  1. How are hash functions used in cryptocurrencies like bitcoin? (Try to research this on your own, we will cover this later in the course but challenge yourself and see if you can find information on this already now).

Hash functions are used in bitcoin by confirming new transactions on the blockchain. This requires a lot of guessing

  1. What does it mean when we say that hash functions need to be collision resistant? (We didn’t use the term “collision resistant” in the lecture, but you will easily find this on Google, we add this question intentionally to make you research information on your own, that’s how you learn best).

Collision resistant pretty much means that it’s impossible to find two intercepting inputs

1 Like
  1. Hash functions are linear one way and produces unique fingerprint.
  2. Hash functions used in bitcoin works like this: many miners records transactions on the bitcoin blockchain by transforming an input to an output.
    3.Collision resistant means it is statistically unlike to generate the same hash for a different input.
1 Like
  1. A hash function takes any string of data and converts it into 256 bits. This process is impossible to reverse and provides a unique identifier for your data.
  2. In Bitcoin the Hash function is used to hash transaction data. Also mining and finding a nonce requires finding a number that generates a specified hash in combination with data unique to that block.
  3. Collision resistant means two different things not getting the same hash.
1 Like

Ans.:

  1. the defined one-to-one mapping from any input data to unique digital fingerprint

  2. miner needs to iterate nonce number to produce the hash output, until the output number is equal or less than a small target number

  3. we need to avoid the cases that two different input generate the same output, which will make the attacker easier to guess the input and then manipulate the block

1 Like
  1. Hash functions are way one functions of certain input that produces a certain output, one way in meaning you can not go from output to input , every input creates a unique output ,digital fingerprint which can be used to validate digital products
  2. Hash functions are used in mining trying to guess the output of future blocks, compiled with data from previous blocks and lots of computing power.
    3.Collision resistant means that it shouldnt be possible to create two inputs with the same output in a hash function, important for security issues of course.
1 Like
  1. Hash functions are functions that give a unique input which then creates an equally unique output.
  2. Hash functions are used in cryptocurrencies like Bitcoin for the purposes of hashing out blocks for miners as well as generating public keys.
  3. Collision resistant means that while it is not impossible, it is extremely unlikely for two inputs to generate an identical output.
1 Like
  1. Hash functions are one-way functions that run an input through a one-way algorithm- it is impossible to go backwards from output to input
  2. Hash functions are used in the mining process. A block of unconfirmed transactions is hashed, and then the miner uses that digest in the mining process to create an output with the appropriate amount of leading zeroes.
  3. Collision resistant means that no two inputs will produce the same output when moved through the same hashing function
1 Like

1.) A hash function is a one-way function established by inserting a specific input and then receiving a completely unique output with its very own characteristics; thus, a specific digital fingerprint is created through this function.
2.) Hash functions are used in cryptocurrencies like Bitcoin through creating new transactions on the blockchain from the mining process. The block hashing algorithm creates a block that can’t be taken back, reversed, or retraced. Solving these hashes to create a block takes a large amount of computation, but miners who solve these equations are greatly rewarded with additions to this permanent record of transactions (making up the blockchain).
3.) Hash functions need to be collision resistant, meaning that: any input (and any amount of inputs) into a hash function should not create an easily found output. These hash functions need collision resistance to insure security.

1 Like
  1. A one way function that produces a unique output from an input of any form and size of data, including digits, letters or even larger media files, and translates them into an alphanumeric string of a certain size.

  2. Hash functions are used in cryptocurrencies primarily, to pass transaction information anonymously

  3. Everything has a unique identifier, cannot produce the same hash twice

1 Like
  1. A hash function is a function that has a unique output for every unique input. With a hash function you can get an output from an input but you cannot calculate the input given a specific output

  2. Hash functions are used in the proof of work because they cannot be solved except with trial and error (trying different inputs and seeing if you can get to the correct output). Bitcoin miners are given a hash output target in the block header and they have to find an input that will get that hash or less. The blocks build on each other so that you have a starting point from the previous block as an initial point in the iterative process.

  3. Hash functions rely on the uniqueness of outputs given a specific input. Collision resistance is a measure of how hard it is to find two inputs that result in the same output (non unique). The hash functions in blockchain applications need to be proved that the amount of computing power an attacker would need to find a collision point (a second input with same output) would not be feasible for someone to do and also knowing what this value is makes it more secure.

1 Like

01 - Describe hash functions with your own words.

A Hash function, is a computation that takes an input, and gives an output “hash”. What makes a hash so unique, is that there is no way to derive the input from the output. In other words “it’s a one way computation”.

This is important in cryptocurrency’s as these “hashes” proof that the blockchain is unaltered.

02 - How are hash functions used in cryptocurrencies like bitcoin?

Hash functions are used in cryptocurrency’s and bitcoin in multiples ways. Including but not limited to :

  • Private/public key generation.

  • Proof of Work : ( Hashing and hashing to find a “nonce” within the difficulty target )

  • Connecting all the blocks together. ( Previous block hash + Tx list hash + Nonce hash = Block hash )

What does it mean when we say that hash functions need to be collision resistant?

It means :

The chances of 2 different inputs resulting in the same output, need to be so small, that it is extremely unlikely, yet plausible to happen.

For Example :

You create a new MetaMask, you generate some extra addresses connected to the same seed phrase.
Now how many extra wallets would you have to generate to be given someone else’s private key by chance? This is such a small chance that it is very unlikely to ever happen. Hence, the wallet generation process is “collision resistant” .

1 Like
  1. All data are transformed into a fixed length string of numbers and letters.
  2. Hash functions are used to write new transactions through mining.
  3. Collision resistant is when it is hard to find two inputs that give the same output.
1 Like
  1. Hash functions is a way of each unique input will produce a unique output.
  2. A hash is a function that meets the encrypted demands needed to solve for a blockchain computation. Hashes are of a fixed length since it makes it nearly impossible to guess the length of the hash if someone was trying to crack the blockchain. The same data will always produce the same hashed value.
  3. Collision resistance is the property of a hash function that it is computationally infeasible to find two colliding inputs. This property is related to second preimage resistance, which is also known as weak collision resistance.
1 Like
  1. much like a regular function only encrypted.
  2. hash function in crypto takes any input applies a mathematical equation and you receive a digital finger print as the output.
  3. having differing outputs from the same input will eventually cause a collision.
1 Like