Homework on Hash Functions - Questions

1.Hash function uses a unique input to produce a unique output.
2. It is used to make sure you can’t find the input by seeing and working with the output.
3. The birthday paradox shows you can come up with the same output by chance . A good algorithm makes it nearly impossible to run into the same output. It is basically impossible to get the same output in the SHA 256 Algorithm.

1 Like
  • Describe hash functions with your own words
    hash functions is a special class of programming functions that for its characteristics is particularly suitable for cryptography
    a HASHFUNCTION is:
    deterministic
    quickly computable
    pre-image resistant
    collision resistant
    puzzle friendly

  • How are hash functions used in cryptocurrencies like bitcoin?
    in cryptocurrency like bitcoin hash functions are used to chain together the blocks of datas since every block contain an hash function that point to his previous block.
    the hash function is also used to generate bitcoin addresses.

  • What does it mean when we say that hash functions need to be collision resistant?
    collision resistance is a propriety of cryptographic hash functions. it defines that each input will have his own unique output. 2 different input resolving in the same output is a collision.
    (no hash function is collision free, so collision resistant means highly unlikely)

1 Like
  1. One way string, input to output only.
  2. Bitcoin uses hashing to secure the network by solving for the correct nonce.
  3. The Birthday Paradox must be so infeasible to be collision resistance. The value of the hash must be of high min-entropy to make it so this does not happen.

Homework on Hash Functions - Questions

  1. Describe hash functions with your own words
    Hash functions are a mathematical formula which uses cryptography to input a piece of data creating a specific output as a digital fingerprint

  2. How are hash functions used in cryptocurrencies like bitcoin?
    BTC uses SHA 256 in order to ensure that all hash’s contain the same amount of data. It is the most secure network on the planet due to this particular hashing function and also that block tones are 10mins apart in order to reduce chances of a collision etc

  3. What does it mean when we say that hash functions need to be collision resistant?
    Hash functions need to be collision resistant as if it were a less complex formula than for instance Sha 256 there is a remote possibility of two identical digital fingerprints being produced.

  1. Describe hash functions with your own words

A hash function is the taking of input string of varying size and turning it into output string of a fixed sized.

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

Hashing functions are used in Bitcoin through the mining proof of work process. Hashing is used to verify new transactions.

Reference - https://www.coindesk.com/bitcoin-hash-functions-explained

  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 resistance refers to insuring that the inputs don’t produce the same outputs when hashed. When this occurs this could compromise security by introducing the threat of double spending to the system.

Reference - https://bitcoinexchangeguide.com/bitcoin-hash-functions/

1 Like
  1. Describe hash functions with your own words
    Hash functions take a unique input and gives it a unique output so if I put “dog” as the input I will get a unique output, kind of like a digital fingerprint, in the form of a unique number (made of numbers and letters) but if I would change it to “dogg” I would get a completely different output in the form of a completely different digital fingerprint and number. Hash functions are one way which means they can only go from input to output, not the other way around, If someone figures out to do this, bitcoin will be broken.

  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).
    Has functions are used to make blocks out of all the transactions on the blockchain. Has functions are used as proof of work for miners and are what gets them paid basically… (not sure of this one so if someone wants to correct me, feel free:) )

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).
It basically means that two different inputs cannot get the same output, it is very unlikely (but possible??)

  1. a hash function is a function that takes an input and outputs a unique fingerprint (a hash). this hash is always the same with that input. the hash can not be reversed or the hash function would become obsolete. like md5

  2. if a new block is mined, the hash of the new block get ?concated? (put right after each other) with a random string (nonce). This string is hashed again and compared with the dificulty level. if it’s lower, the new block gets approved

  3. collision means that 2 sets of data have the same hash, this could be producing problems in the future. because SHA 256 has 2^256 combinations means that when your input go beyond that amount there has to be collision .

The miner wil create a block with transactions from the mempool. A valid block needs to have a hash lower than the target(difficulty) so it has to have a certain amount of leading zero’s. To achieve this you need to add some random number in the block. example add nr. 55000 as the nonce. hash it and check if the hash is low enough. usually it isn’t low enough, so you need to change the nonce to another number and try again. over an over again until you found a number(nonce) that produces a low enough hash. then the miner can broadcast this block.

1 Like

Describe hash functions with your own words

Hash functions take input data of an arbitrary size and give an output that is a fixed size. This output is called a hash. To fit that input data into a different size, the hash function uses a mathematical algorithm to map the input data and produce the hash.

This hash is often one-way, meaning that it is non-reversible. The only real feasable way to understand the original input, is to brute force search all the possible inputs until you find an input that gives the same hash.

Depending on the complexity of the hash function, this can take a long time. For Bitcoin the average time is 10 minutes.

How are hash functions used in cryptocurrencies like bitcoin?

Hash functions are used is in cryptocurrencies to maintain the security of the network through making sure no-one can shortcut their way to finding the right input, which would cause an unbalance for the network, and jeopardize the decentralization of the system.

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

When we talk about collision resistance in hash functions, we are talking about how low the chance is for two different inputs to have the same hash output.

1 Like

The average time of 10 minutes is not to brute force a hash function to know the input. It’s almost not possible to brute force Sha256. It will take you an astronomical amount of time to do this.
The 10 minutes is a target the the bitcoin network wants to have between every block in the blockchain. if more miners are mining, the probability of Mining a new block gets quicker. (and vice versa) every 2016 blocks the difficulty gets adjusted to keep an average of 10 minutes between all blocks.
miners are basically brute forcing a random number (nonce) in a block they want to mine and check if the hash is low enough.

Thanks for the clarification @Fabrice :slight_smile:

1 Like

if i understand correctly, the miner takes a bunch of transactions that aren’t confirmed yet. put them in a new block that has the potential to be the real new block. with the creation of that potential new block a hash is automaticly created for it. than they start trowing nonces at it until output hash from the combination of the potential block hash + the nonce has more zeros in front of it than the difficulty level.
difficulty level = 0000.0025
lower new block hash = 0000.0005

1 Like

yes! Awesome, you get it :+1::sunglasses:

1 Like
  1. Hash functions are the type of functions that can take any input and produce output out of it in the form of hashes. The hash function also doesn’t support reconstructing the output to input.

  2. In the case of cryptocurrencies like Bitcoin, the hash functions are used to run transactions as input through a hashing algorithm to produces the output of a fixed length.

  3. It means that it should be difficult for the hash function to generate.from two different inputs the same output.

1.is a one way functions. makes a secure transmission between peers

  1. in the case of SHA-256, no matter how big or small your input is, the output will always have a fixed 256-bits length.

3.with two diffrent input,no chance to get two same hash. make a hash unbreakable

  1. Hash functions are functions that transform initial data with different sizes into final data with the same size.
  2. Hash functions are used in cryptocurrencies like bitcoin as part of the mining process, in which the input is composed of the most recent not yet confirmed transactions along with inputs related to timestamp and a reference to the previous block, and the output through the SHA-256 hash function (in the case of Bitcoin) is a 256-bits fixed length string of numbers and letters.
  3. Collision resistance in hash functions means that it is difficult to relate different inputs to the same output.
1 Like
  1. A hash function is a one way function where any input has an output of a fixed length. The smallest change to the input will produce a completely different output. It is impossible to go from the output back to the input.

  2. Hash functions are used to write new transactions into the blockchain by mining.

  3. Hash functions are collision resistant if it is hard to find two inputs that hash the same output. This is necessary so that all of the outputs will be different.

1 Like
  1. Hash functions have 2 characteristics in that
  • each unique input generates a unique output i.e. unique fingerprint, and
  • it is possible to know the output from knowing the input but the reverse is not true i.e. it’s not possible to know what was the input from looking at the output.
  1. The Bitcoin chain is based on SHA-56, a secure hashing algorithm. It’s pre-image resistance is almost infinite - what this means that it is impossible to know the input by looking at the output. This has never happened and is the reason why the bitcoin chain is so secure.

  2. “Collision” takes place when different, and unique, inputs results in the same output. Although the probability of collision is higher than the pre-image resistance, the possibility of collision is still astronomically low.

1 Like
  1. Hash functions basically are a mathematically way of securing data and on top of that, fulfilling 6 special crypto properties. Each unique input gives a unique output, and a certain output can not be retraced back to the input.
  2. How hash functions used in cryptocurrencies like bitcoin:
  • To authorize a transaction by encrypting your private key (signatures) and public address
  • To lock in a certain amount of crypto in order to prove your ownership of those coins. The goal is to get a certain amount of other crypto from your counterparts… So called atomic swap.
  1. When we say that hash functions need to be collision resistant, it means that we have to rule out the possibility, that two different inputs (into a hash function) generate the same output. Therefore the amount of possible inputs needs to be so high, that a coincidence of this specific event taking place, is exceptionally low.
1 Like

Homework on Hash Functions - Questions

  1. Describe hash functions with your own words

A hash function is unique so the input input which gives unique output. It is very much like your own DNA or fingerprint very and highly improbable to duplicate. This also is a one way fun function that cannot be done in reverse.

  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 hashing function takes the data and hashes into the blocks so that all strings are joined together and hence forms the chain of blocks that become immutable.

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

No two inputs should have the same output.

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 ( a ) = H ( b ), and ab .[1]:136

Every hash function with more inputs than outputs will necessarily have collisions.[1]:136 Consider a hash function such as SHA-256 that produces 256 bits of output from a large input (≤ 264-1 bits). Since it must generate one of 2256 outputs for each member of a much larger set of inputs, the pigeonhole principle guarantees that some inputs will hash to the same output. Collision resistance does not mean that no collisions exist; simply that they are hard to find.[1]:143

1 Like