Homework on Hash Functions - Questions

  1. Hash functions are one-way functions, follow certain mathematical algorithm, with any input, get fixed size unique output.
  2. The information in the blocks are hashed and the hash is used to link the blocks together. So the hash of the previous block is inside the current block. So if you want to change some info in a certain block, you must recalculate all hashed of all previous blocks too.
  3. Collision resistant means it is statistically unlikely to generate the same hash for a different input.
1 Like

Yes they are also used for that. A transaction hash is its id. But more importantly hash functions are used to link the blocks together in a chain :wink:

2 Likes

This is all true. But how or where is it used in Bitcoin? :wink:

1 Like

Its true that transactions are hashed, but are not used to encrypt them. Its just a method to get the transaction id. Hash functions have a more important role in linking the blocks together in a chain, thus the name :wink:

1 Like

Bitcoin just utilizes the functionality of hash functions, so they are not really equal :slight_smile: Can you give me an example where hash functions are used on the blockchain?

1 Like

Ans.)
Each time a transaction is processed from an input to output a hash function is created on that data set, and once confirmed by a miner, it gets placed into a block on the block-chain.

1 Like
  1. Hash functions are in essence a function where the input creates an output which cannot be used to reverse the function and discover the input used. Each hash function creates random outputs that don’t create any noticeable pattern in order to start with an output and discover the input.

  2. Hash functions are used in cryptocurrencies in order to create private and public keys so that each user has a unique id that allows them to access their money on the blockchain that only they can access since the private key can’t be discovered from the public key used to send transactions to specific people.

  3. If a collision occurs in a hash function this means two different inputs equal the same output which is dangerous if this occurs because in the case of bitcoin it would allow someone else unknowingly be able to create a wallet that has the same access as someone else and would be able to access their funds.

1 Like
  1. Hash function is that kind of function where every unique input have a unique output

  2. Hash function in bitcoin is used to translate the amount of VALUE input in a cryptographic output

  3. COLLISION RESISTANT I think is used for the strong property of SHA256 to DONT let you go to the input throw the output

1 Like
  1. Hash functions are a function make to give a specific output of a definite lenght for every input that you enter. I should also be impossible to deduce the input from the output, when there is no problem the other way around.

  2. They are used as part of the block hashing algorithm to add new blocks to the blockchain by mining.

  3. I didn’t watch on Google, but it’s obviously that the collisions need to be so infinitecimally small in probability that it becomes infeasable to occur.

1 Like

1- In hash function each unique input gives a unique output, it’s almost impossible to guess the output before the input because any little change in the input changes the output in a completely different way.
2- To write new transactions into the blockchain through the mining process.
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.

1 Like

1.Describe hash functions with your own words.

Simply hash functions are mathematical functions used at crypto, it contains inputs and outputs, it takes inputs with variable length to give outputs with fixed length.

2.How are hash functions used in cryptocurrencies like bitcoin?
First of all, bitcoin uses SHA-256
Hash functions are implemented in several aspects of Bitcoin protocol: bitcoin mining, merkle trees and the creation of Bitcoin addresses

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

Let us take two different inputs A and B where H(A) and H(B) are their hashes, H(A) will not be equal to H(B). So for the most part, each input will have its own unique hash.

1 Like

We don’t derive keys using hash functions, for that we use the elliptic curve :slight_smile: There is another reason why hash functions are used. Can you figure it out? :wink:

1 Like

What do you mean by that? Its true that transactions are hashed so we get the transaction id. But there is a more important use case for hash functions :slight_smile:

No, this is the property of non reversible function :slight_smile: collision resistance means its hard to find two inputs that result in the same output.

1 Like

No hash functions have a different use case. What you are describing is public key cryptography. :slight_smile: Can you try again and figure out the real use case for hash functions in blockchains? :wink:

1 Like

I was trying do find something without google Search, like Ivan recommend in the last lesson

But I was wrong , thnx MATE

1 Like

Thank you very much for your e-mail.

Hash functions are implemented in several aspects of Bitcoin protocol: bitcoin mining, merkle trees and the creation of Bitcoin addresses.

Kind regards,

Murad

1 Like
  1. Describe hash functions with your own words
  • It is a function that will generate outputs that cannot be reversed. A one way function.
  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).
  • It is used to connect the block’s. The output need to meet the requirements of the difficulty to be valid. That’s why miners need to hash a block with brute force.
  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).
  • To avoid that multiple (not similar) inputs generate the same outputs. However this is not impossible, but the chance of it acuring in this function is extremely small.
1 Like

A hash function,is a mathematical algorithm which is applied to an input, that produces a unique output in the form of a string of characters. This output represents the digital fingerprint of that information and can only be reproduced if the input is exactly the way that input is entered.

Hash functions are used in crytocurrency as a mathematically secure method to protect the input data which protects the integrity of the transaction. The hashed outputs create the building blocks of each block on the chain and backwardly connect each block to the previous block and so on all the way to the genesis block. The nature of the hash function protects the integrity of the chain because any change in a single block would cause the previous blocks hash results to change, and the nodes in the chain would not meet consensus because they would not be able to agree due to those different results of the hashing that simply would not match.

Insofar as the need for hash functions to retain the property of collision resistance, its quite easy to see that if any attacker were to find a pattern in how alternate inputs result in an equal output, it would be possible for the adversaries to begin to dissect a manner to duplicate this process, and eventually overtake the system. The less likely the collision becomes, the more exponential guesses the adversary has to take on. Thus we have seen a shift from weaker algorithms that output fewer characters fade out of the realm of use, while more complex outputs with larger output strings have so far remained resilient.

1 Like

A hash function uses an algorithm such a Secure Hashing Algorithm 256 (SHA256) to convert any unique data input into a unique data output or hash.

In cryptocurrencies like bitcoin Hash functions are used to uniquely secure each block of data before adding it to the chain of blocks by hashing the data and memory address of the previous block. A random string or nonce is also added to increase uniqueness of the hash. Together, this hash is compared to the difficulty level to see if it meets the requirements of the difficulty level (it has to be less) if it does not meet the difficulty level the process is repeated until it does. And when it meets the requirements the new block is added to the chain and the entire network is notified.

Collision Resistance means that each unique input would have its own unique hash output; so if two unique inputs result in the same hash output that is know as a collision. A good hash function should be resistant to or avoid this from happening.

1 Like
  1. Hash function is a one-way conversion of a string of data to a fixed length output.
  2. Bitcoin hashes transaction data, creating addresses, keys.
  3. Two inputs transforming into the same output is in feasible.
1 Like