Homework on Hash Functions - Questions

  1. Describe hash functions with your own words
    Hash functions are a special type of function where each unique input has a unique output. The output is like a digital fingerprint of the input data. Hash functions are also one-way, in that it is infeasible to extract the input from the output.

  2. How are hash functions used in cryptocurrencies like bitcoin?
    Hash functions have special properties that are crucial to the functioning of cryptocurrencies.

  • Because hash functions are deterministic, the input data generates a unique output hash.
  • Pre-image resistance in hash functions ensures even the smallest change in input data drastically changes the hash output.
  • In a blockchain, the hash pointer of each block points to the previous block in the chain AND also contains the data of the previous block
  • When an attempt is made to change the data in (say) block #6, it drastically changes the hash for that block. But because the block ALSO contains the hash pointer (data plus address) of the previous block, this will be different from the hash stored in block #5… and block#4 and so on. Thus even the smallest change in any block is immediately noticed and nullified by the preceding blocks. This is how a blockchain achieves immutability.
1 Like

This is not exactly what a collision is. A collision is the possibility of two inputs resulting in the same output in a hash function :slight_smile:

1 Like

Merkle tree is a tree like data structure of hashes and is made of transaction ids :slight_smile: But there is another important usecase for hash functions. Can you figure out which one? :wink:

1 Like

Collision resistance is a property of hash functions, not ledgers in particular. It simply means how probable it is for two inputs to result in the same output :slight_smile:

1 Like

1.- Hash function is a transformation of a data from an input to an output and once it is
done it can not be reversed, that means you can not find the input from the output, otherwise it is not a hash function…
2.-They are coding datas in the transactions so they can not be reversed (security, immutability)
3.-it needs to have the same amount of inputs than the outputs, for example if they are 2 inputs for 1 output, there is a collision. It is very hard, almost impossible to have collision normally because a good hash function generates a huge amount of possibilities (i.g SHA 256)

1 Like
  1. HF is true “oneway road” how to certify content
  2. For my understanding HF is backbone of blockchain. Goes from (Edit-false-xpriv,xpub), addreses,to packup transactions to root, till hashing of block.
  3. Collision resistance probably mean that is galacticaly rare to get the same hash for two or more different data sets.
1 Like
  1. Hash Functions are one way functions which transform input text to unique output.
  2. Hash functions are used to encrypt the transaction data so its secure and only the intended recipient can decrypt it.
  3. Collision resistance means that is very difficult to find 2 inputs that produce the same output in a hash function.
1 Like

xpub is derived from xpriv using a different function called elliptic curve, but addresses are hashes of the xpub :slight_smile:

2 Likes
  1. Hash functions take data of arbitrary size as an input and produce strings of fixed length as outputs.

  2. In cryptocurrencies, hash functions take transaction data as inputs and output strings of fixed length. However they do need to be more secure than your regular hash function, so we use cryptographic hash functions instead, which have the following desirable properties:

  • Deterministic (or injective)
  • Computationally fast
  • Pre-image resistant (given a hash function H and data x, it is infeasible to find x given H(x) )
  • ‘Unstable’ (in mathematics, we say that a solution is unstable if a small pertubation in the intial conditions of a differential equation result in a large change in the final solution. In computer science, the term used is ‘avalanche effect’: a small change in the input data results in a large alteration of the outputted hash)
  • Collision resistant (see 3.)

In the case of (proof of work) cryptocurrencies, it is also desirable that the ‘puzzle’ to find a nonce that rewards the miner with the currency is challenging, but is also easy to have possible answers checked, to even the playing field and allow anyone to partake in the mining process.

  1. Collision resistance means that given a hash function H, and data x and y where x != y, then H(x) != H(y). (sidenote: in mathematics we would say the hash function H is injective. I don’t know why computer science insists on having differing terminology. The same could be said for American and British English.)
1 Like

xpub is derived from xpriv using a different function called elliptic curve, but addresses are hashes of the xpub

Holy true, man, i need a break :smiley:

1 Like
  1. Hash produces unique digital fingerprint of an unique input
  2. In Bitcoin Hash function is used in mining to to produce a unique block
  3. Collision resistance that is extremely difficult to 2 inputs that produce similar outputs
1 Like

1.) Hash functions take any input and creates a unique output, fingerprint. The unique output (fingerprint) cannot be used to discover the input.

2.) An example for bitcoin, the public key for a wallet is a hash of the private key. It would be infeasible for your private key to be discovered from the public key due to the secure hashing algorithm (SHA-256).

3.) A collision occurs when two exact outputs are created from different inputs. Due to the vast amount of possible outputs with SHA-256 this is infeasible.

1 Like
  1. A hash function is a one-way computation that creates a unique output per input and also can never be figured out from the output alone.
  2. Hash functions are used in the creation, mining, of bitcoin.
  3. The term collision resistant in regards to hash functions mean that the chance of two outputs equaling is so unlikely it’s infeasible.
1 Like
  1. The function of a hash enables you to provide a unique input to calculate a unique immutable output.

  2. The use of hash functions in cryptocurrencies (like bitcoin) hashing is mathematical algorithm (SHA 256) used to input a string of data of any size into a transaction to produce an output of data in a fixed size.

3.Colision resistant means that when a transaction is inputed it’s complex enough not to produce the same output result no mater what the variable is. It’s not impossible but very very highly unlikely and difficult.

1 Like
  1. Hash functions are one-way only, where every unique input will produce a unique output.
  2. For maintaining the bitcoin ledger through mining, also used to create Bitcoin addresses.
  3. The chance of 2 unique inputs having the identical output.
1 Like
  1. a hash function is a function in which you determine the output from the input but not the input from the output. additional one identical input always gives back the identical output.
  2. hash functions are used to combine TXs and a nuance to generate an output according to the difficult level.
  3. collision resistant means that it is highly unlikely to generate the same hash output for 2 different inputs.
1 Like

1, Hash functions are special functions that its inputs are very hard to be traced.
2. It is used to create digital fingerprints that are used in creating secure transactions.
3. Hash functions need to be collision resistant to be secure, so that nobody can easily track down an input.

1 Like
  1. Describe hash functions with your own words
    Answer:
    Hash function is a one-way function that is the process of converting an input of any length into a fixed sized string text using an mathematical function.

  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).
    Answer:
    Hashes are used to represent the current state of a blockchain and to ensure its immutability. Every transaction contains a certain bit of information. Such as the amount being sent, the sending and receiving addresses, the time stamp, and so on.
    All this information is combined into a mathematical formula hash called Transaction ID. The transaction ID is a Hash value which can be used to identify and confirm that a transaction has happened.

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

Collisions is when you have 2 different inputs, you take it through the hash algorithm and both different inputs produce the same massage digest which makes it a collision. Two different things produce the same thing = collision.
Technically it should not happen with Hashing, it is possible but highly unlikely to alter it.

1 Like
  • Describe hash functions with your own words
    Is where you apply hash to a certain input to get a very complex code which can not be traced back to the input. One way code.

  • 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 write new transactions into the blockchain

  • 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).
    Every hash function with more inputs than outputs will necessarily have collisions

1 Like
  1. Describe hash functions with your own words
    What sets hash functions apart from normal functions is that it not possible to derive the input from the output, hash functions are one way functions. Another characteristic is that each unique input gives a unique output, making the smallest change in the input data changes completely the output.

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

Hash functions are used to identify the transactions and to make sure that the transaction is not changed afterwards.

  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 means that for a unique input there is always a unique output, if input A and input B would have the same output, this would be a collision.

1 Like