Homework on Hash Functions - Questions

  1. A hash function is a one way function where a unique input gives a unique output.

  2. In BTC hash functions are part of block hashing algorithm which is used to write new transactions into blockchain through mining process

  3. It means it is difficult to find two inputs that hash to same output

  1. :arrow_right: ONE WAY! Hash is a function that turns any arbitrary input to a fixed-length output. It works one way from input to output, it is not possible/feasible to work backward from output to input.
  2. :loop: The blockchain is a linked list that contains data and a hash pointer that points to its previous block, hence creating the chain. :chains: :loop: It includes not only the address of the previous block but also the hash of the data inside the last block.
  3. :blue_car: :fire::red_car: Collision is that two different inputs resulted in the same output. Collision resistence means simply collision proof.

Q1:
A hash function takes an input, runs it through a hashing algorithm, and outputs an alphanumeric string called a hash (like a fingerprint). A hash function must be:
a) deterministic - it must output the same hash/fingerprint for the same input every time.
b) fast - to enhance efficiency.
c) pre-image resistant - infeasible to determine the input from the hash/fingerprint (not impossible but impractical to attempt).
d) any change, no matter how small, to the input will produce a different hash/fingerprint.
e) collision resistant - infeasible that two different inputs produce the same hash/fingerprint.
f) puzzle friendly - the hashing algorithm tries to be as neutral as possible to ensure all stakeholders have an even chance as each other to determine the input ??? I’m not sure about this one - I’m guessing in this case miners ??

Q2:
As in f above I think bitcoin miners try to determine the input from a hash/fingerprint to discover new bitcoins ??

Q3:
No hash function is perfect. There are ā€œcollisionsā€ where the same hash/fingerprint is produced from different inputs. A good hash function makes this infeasible. My question is how are collisions dealt with ??

  1. A mathimatical equation where an input creates a unique output.

  2. Miners use hash functions to process/verify transactions which is added to the existing blockchain.
    Hash functions a core part of PoW (proof of work)

3.Collision resistance is when you have a hash function with a very low likelyhood of 2 different inputs creating the same output

  • Describe hash functions with your own words
    - A hash function is a mathematical process that for desired input gives you a specific output made out of numbers and letters and of a fixed size.

  • 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 in bitcoin and similar cryptocurrencies are a part of block hashing algorithms which are being used to store transactions. Each transaction is being stored in a form of this hash output, and they connect one after another in blocks. (This is my understanding for now hahah)

  • 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).
    -When we say that collision is resistant what we mean is that it is very hard to find 2 inputs that would take us to the same output.

  1. Each input gives a unique output. The opposite is not possible

  2. There are certain properties that a cryptographic hash function needs to have in order.

  • Deterministic / Quick Computation / Pre-Image Resistance /
  1. That each input will input wil have its own unique hash.
  1. A hash function converts information into a unique output. It is a one way operation, i.e. it is impossible to determine the input hash from the output hash.

  2. Cryptocurrencies utilise hash functions to ensure the security and immutablity of the blockchain. A hash of the previous block is an intrinsic part of the next and all subsequent blocks. If any blocks are altered then the entire blockchain will also change making it impossible to tamper with any of the information contained on the blockchain.

  3. Being collision resistant means that it is extremely unlikely that two inputs to a hash function will result in the same output hash.

  1. A hash function takes an input, applies a hash algorithm (like sha-256) and provides output of fixed length as determined by the hash algorithm.

  2. Hash functions are used in cryptocurrencies when mining for new blocks. A random string is attached to a hash of the most recent block. The information is then hashed again and compared to the difficulty level. If lower, the random string is changed and the process gets repeated. If higher, the block is added to the public ledger and the miners responsible are awarded in bitcoins.

  3. Collision resistance is when it is not feasible for two different inputs to have the same hashed outputs. Each hash input will therefore have a different hash output.

  1. A hash function is a bit of data or any information that gets run through a hashing algorithm to create ( in sha256 ) case a unique 64 character representation of the input data.
    2.transactions on the bitcoin network are hashed multiple times in a merkl tree to save storage space and for organization

3.Collision resistance means that you do not accidentally get the same 64bit hash with different inputs

  1. Hash function is a function based of algorithm which can be solved only one way. Hash function always gives the same output for the same input, but at the same time, only slightest change in input will result in dramatical output changes.
  2. Hash functions is used in mining to determine required computation power to solve it so that a new block could be added to chain. Since, the only possible way to get required output, is by generating random inputs, there is no short cuts and required amount of work should be done.
  3. it means that to probability of two different inputs resulting in the same output is very low.
  • Describe hash functions with your own words
    A Hash function converts unique data input in to a unique output.

  • 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 to make every piece of data unique.
    The hash pointer is pointed to the previous block, and the block before that contains the same constituents including a hash pointer pointing to the previous block etc.
    All these blocks together form a blockchain.
    If anyone happens to temper with the data, the hash will change dramatically and will be noticed by all the blocks and will simply be ignored. This makes the blockchain and technologies like bitcoin immutable.

  • 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).
    That its almost impossible to generate the same hash for two unique pieces of data.

  1. Describe hash functions with your own words.
    A Hash function takes a changable input to a fixed output length. Once encoded its impossible to reverse and therefore protects your data.
  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).
    Through mining and transaction .
  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).
    [/quote]
    The probability of producing the same output with two diffrent inputs is almost impossible. This is a condition for a working hash functon.
  1. Describe hash functions with your own words

A hash function is a function where an input is hashed and generates a fixed length output or value, no matter the size of the input. The slightest alteration of the input will drastically change the output, but the same input will always give the same output.

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

Hash functions are used in Bitcoin in mining and transactions. In Bitcoin mining, miners must hash a block header that is equal or less than the target hash. When a miner successfully does so, this is how new blocks are created in the blockchain.
Transaction hash (txid) is also used to uniquely identify on-chain transactions.

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

Hash functions need to have an extremely low probability of two different inputs giving the same output. Since there are more combinations of inputs due to the output being fixed length, this is feasible. Hash functions need to be collision resistant because in the chance of a collision it could change data in previous blocks without rewriting them.

  1. Describe hash functions with your own words
    a hash function is an function that takes any input and gives you an standardized output unique to the input

  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).
    strings of transactions are condensed into to hashes that needs to be checked instead of the whole document.

  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).
    Two different inputs shouldn’t have the same output

Describe hash functions with your own words
Hash functions are one way functions where one input produces a unique output.

How are hash functions used in cryptocurrencies like bitcoin?
Hash functions are used for creating addresses, private and public keys. But each block also has its unique hash.

What does it mean when we say that hash functions need to be collision resistant?
A hash function is collision resistant if it is hard to find two inputs that hash to the same output.

  1. hash functions is using a specific algorithm to produce a one way output [digital signature]
    2 hash functions is used by miners for new block creation.
    3.a hash function must always be 1 way, it should be impossible to get the same input from 2 different outputs for the algorithm to be collision resident.
  1. Describe hash functions with your own words.
    Hash functions are to add security using algorithms for unique finger prints. A certain input creates and output and it only can go one way. You cannot backt race from output to input.

  2. How are hash functions used in cryptocurrencies like bitcoin? Used in their creation and blockchain of mined Bitcoins.

  3. What does it mean when we say that hash functions need to be collision resistant? There should not be more than one particular hash for any specific term. The hash should only have one result. more would be a collision of terms.

Hash functions take an input of data and converts that data into 256 bit output which is irreversible
Hash functions are used to generate unique signatures to every transaction added to the block
Collision resistance meaning two different inputs will never have the same out put.

1 Like
  1. Hash function are one way functions that means we get unique output from each unique input. Opposite direction from output to input is not possible.

  2. Each block contains the hash of the data inside previous block - this make the blockchain immutable and reliable.

  3. Collision resistance depends on the length of the hash. As the hash is shorter, the resistance decreases exponentially. It is almost impossible to have outputs that are equal (but not impossible - therefore, the hash length should be long enough to prevent a collision).

  1. A cryptographic hash function, is a transformational algorithm which outputs a unique encrypted ā€œfingerprintā€ for a unique input.

  2. The hash function is used to encrypt the records of transactions on a block. Each block has a header section. In there, is the hash of the previous block. This acts as a link between the new block and it’s predecessor

  3. Collision resistance refers to the difficulty in finding two different inputs produce the same hash output.