Homework on Hash Functions - Questions

  1. Hash functions give any input a unique output.
  2. They are used to verify these transactions. Rather than comparing all the data, you can compare its hashes. This is much more efficient.
  3. If you have two different inputs that create the same output you would have a collision. Then you can no longer speak of a unique fingerprint of the input.
1 Like
  1. Describe hash functions with your own words:

Hash functions are mathematical functions that convert an input into a fixed set of numbers and letters(output or hash value).

  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).

The hash functions used in cryptocurrencies are used to hash transactions into the blockchain through mining. Hashes are also used in addresses and keys.

  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).

Hash functions need to be collision resistant so that it is very difficult to hash two inputs that hash to the same output.

1 Like
  1. You can put a unique input in the function and recieve a unique output, but you can never reverse that process.
  2. To hash transaction data. You mine new blocks in the blockchain by putting in unconfirmed transactions as hash functions an guessing the output.
  3. A collision means that two different inputs produce the same output or hash. If there are too many collisions because people mine too fast (that’s why there is a 10 min time limit) blcks will sprout into existence simoultaneously which results in so calle “orphan blocks” that are not part of the main chain.

1: Each unique input, of any length, will give a unique output or fingerprint of a fixed length.

2: In the bitcoin protocol, hash functions are part of the block hashing algorithm which is used to write new transactions into the blockchain through the mining process.

In bitcoin mining, the inputs for the function are all of the most recent, not-yet-confirmed transactions (along with some additional inputs relating to the timestamp and a reference to the previous block).

3: 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 such that H = H, and a ≠ b. Every hash function with more inputs than outputs will necessarily have collisions.

1 Like

What do you mean? Miners basically brute force the nonce (random number) until the blockhash is below target

You could write a script where you keep creating new keys and check if it has bitcoin on it. But statistically, you will be wasting your precious time and electricity. It’s like guessing all lottery numbers in 1 row. It’s possible but very unlikely.
If you believe in luck, you can always mine solo on a laptop. Who knows you accidentally find the right nonce for your block with the current difficulty

1 input is the same as utput 5=5 or fd=fd 2.if i send btc . you give me your hash and i send to that hash.input =output. 3.if have more input exs 2 hash will result in a mess .not right exs.input=messy

  1. Hash functions are mathematical functions that take an input and encrypt and compress a string of data into a fixed sized hash output (in the case of bitcoin it is 256 bits)

A key between hash functions and normal is that each hash input creates a unique hash output (a bit like a digital fingerprint).

Also in the case of cryptographic hash functions when you change even a small amount of the input data of a hash function it results in a radically different output hash being generated.

Cryptographic hash functions are pre-image resistant meaning that you are able to take an input and calculate an output however it is infeasible to calculate an input using an output hash.

  1. Hash functions are used in cryptocurrencies like bitcoin as they are crucial to the mining of blocks on the blockchain. They are used for the POW protocol & for validation.

Essentially the data on a new block is hashed & mining nodes compete to successfully solve a puzzle using randomly generated strings of numbers added to the end of a hash & this combination of data is hashed again in an attempt to generate an answer that is less than the difficulty target. This answer is difficult to generate but easy to validate.

The hashing is also used for security as each new block holds the hash of the previous block within its data. This creates immutability as the hash of new block (for example block 7) is dependent on the hash of the previous block (for example block 6). In turn block 6 is reliant on block 5 which is reliant on block 4 and so on. This means if any data is changed in any block on the blockchain even just to the slightest detail it will affect the hash output of all blocks that follow. This immutability is one of the key properties & benefits of blockchains.

lastly hashing functions also allow data to be stored more easily particularly large amounts of data which are converted into 256bits, that means 1000 characters or even 1 billion characters would all be converted into just a 256 bit hash making the storage of data easier/more efficient.

Something I also noticed is because each hash output is somewhat of a digital fingerprint it allows for the traceability of data from blocks on the chain. another key property & benefit of blockchain technology.

  1. collision resistance is to say that it is infeasible for the hash output of 2 different imputs to be the same ie it is infeasible for H(hello) = H(goodbye). It is to say that each input calculates a unique hash output.

Infeasible means that it is not impossible however and over a long enough period of time, and enough inputs, eventually two will equal the same result.

1 Like

1.You have an input and run it thru a ‘‘hash generator’’ and it will create a unique fingerprint
which cannot be reversed.
2.Bitcoin transactions are hashed using S HA-256 and when a new block is need to be added, then the hashing of the old block is added to the new blocked and all hashed together…
3.No two different inputs that give you the same output.

1 Like
  1. A hash function is a mathematical operation that creates a unique output (with a fixed length) for each unique input (variable length).

  2. In Bitcoin hash functions are used to write new transactions on the blockchain through mining (proof of work). They are also used to generate new bitcoin addresses by hashing a public key.

  3. Collision resistant means that two different inputs cannot product the same output. If a hash function isn’t collision resistant it is vulnerable to manipulation.

1 Like
  1. Describe hash functions with your own words
    • A hash function is a one way function that takes a unique input and returns a unique output.
  2. How are hash functions used in cryptocurrencies in bitcoin?
    • RIPEMD160(SHA256(PubKey)) → Bitcoin Address
    • SHA256(SHA256(x)) → Generating the checksum in a Bitcoin Address
  3. What does it mean when we say that hash functions need to be collision resistant?
    • This means that it is difficult to find 2 inputs when fed into a hash function produces the same output. [H(a) = H(b) and a ≠ b]
  1. A hash function is a process in which you can take a unique set of data and “hash” it to get a completely unique output that can not be reversed.

  2. A hash function is used in structure of data within a blockchain network.

  3. It means you can’t have 2 separate inputs that produce the same output

  1. Taking an input string of any length and getting an output of a fixed length using a mathematical function. The hash simplifies large amounts of data.

  2. Hash functions are used to write new transactions to the blockchain. The inputs are the unconfirmed transactions.

  3. Hash functions need to be collision resistant in order to avoid two inputs having the same output. It is infeasible but not impossible.

1 Like

Thanks for the response. I was asking more to the degree of, is the example i listed (and you followed up on in practical details) an example of collision resistance of the sha265 hashing algorithm and/or elliptical curve cryptography? I know collision resistance will be mentioned later on, I just want to confirm my understanding is correct in regards to if these instances are collision resistance in bitcoin.

1 Like

Homework on Hash Functions - Questions

  1. Describe hash functions with your own words
    Any input data will be converted to a unique string. You can use different hash encryption method like for example SHA-256 (the one bitcoin is using)

  2. 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).
    I did not research. I guess every block will be stored as a hash. If something changes or someone is trying to fraude the nodes will know as the hashes are not following up correctly anymore.

  3. 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).
    This was actually mentioned in the video on the given URL :slight_smile:
    It means input x and input y might give exaclty the same hash in return. This is ofcourse a huge problem. different input but the same output is called a collision.

1 Like

Describe hash functions with your own words

A hash function is a process that converts inputs of any size into a compressed, fixed output. For instance if you input a value of “Hello how are you” into SHA256, you would get an a fixed compressed output composed of letters and numbers.

How are hash functions used in cryptocurrencies like bitcoin?
Hash functions in bitcoin are part of the block hasing algorithm. It is used to write new transactions into the blockchain through proof of work mining.

What does it mean when we say that hash functions need to be collision resistant?
Hash functions need to be resistant to producing the same output for two different inputs. The collisions should be few and far between to deem the hash function is resistant.

1 Like
  1. A hash function is a one way encryption algorithm that produces an output of constant length regardless of the input.
  2. A bitcoin public key can be produced by a specific procedure of hashing the private key.
  3. A hash function is collision resistant if the odds of two distinct inputs producing the same output are low enough that they are negligible.
1 Like

1: Input to output. Impossible to reverse it or go from output to input
2: To secure all transcations in the vitcoin blockchain and make the irreversiable.
3: a hash function is collision resistant if it is hard to find two inputs that hash to the same output;

1 Like
  1. A hashing function is a way of give an unique input an unique output. The SHA-256 makes it infeasible to determine the input, if you have the output.

  2. Hashing function are used in mining. The hash in a newly created block, is partly made of the hash of the mined block, and the previous blocks. In this way the hashing function ensures, that if you try to change data in one block, you will change the date in all the following blocks. This would break consensus, and the change would be denied by the network.

  3. If the network is not collision resistant, it means that two different inputs, could give you the same output. If that happens it is no longer possible to keep track of the information on the ledger. Therefore the function needs to be collision resistant.

1 Like
Describe hash functions with your own words

A hash function is an input that produces a specific output. No matter how many times you enter the same input you will always get the same output.

How are hash functions used in cryptocurrencies like bitcoin? 

Hash functions are used in the process of storing Bitcoin transactions on the blockchain.

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

Two different inputs can not equate to the same output .

1 Like