Homework on Hash Functions - Questions

  1. Hash function gives a unique representation (digital fingerprint) of a given argument (text, numbers etc.). The hash function is a one way function (pre-image resistant).
  2. If I do understand correctly, the BTC is using the hash functions for verification of transactions down the Merkle tree.
  3. If A<>B => H(A)<>H(B), where H() are hash functions of A an B respectively.
1 Like

Hash functions convert any given input into a unique string combination from letters and numbers. Having only the output one can not guess the input.

In Bitcoin hash functions are used for mining new blocks, where new transactions act like inputs.

It means that the output of the hash functions must be unique for any given input and two equal outputs are not generated by different inputs.

1 Like
  1. mathematical procedure (algorithm) where an input of information is converted to output (alpha-numeric) resulting in a unique fingerprint not feasible to reverse (its a one way function)

  2. HSA are used to verify, authenticate, and convert data to create a unique hash value (fingerprint) in the chaining together of information (transactions)

  3. Collision-resistant meaning it is hard to find two inputs that hash to the same output. The harder they are to find, the more cryptographically secure the hash functions are.

1 Like
  1. Describe hash functions with your own words

Hash functions product unique output with each unique output. Providing same output will result in the same hash. Even the slightest change will result in a different hash.

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

All information of a previous block is hashed and added as a pointer to the current block, this process repeats itself over and over.

  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 happens when different inputs gets same output with is almost impossible though can happen with time. But when it happens it won’t matter e.g. a hash from today is equal a hash hundred years later.

1 Like
  1. A hash function takes input string, convert it into bits , hash it , converts the hashed output into bit and convert the bits into base16 and outputs the result as base16 with a fix 16 length. It is impossible to get the input based on the hashed output
    Every input of a hash function has a unique associated output
  2. Each block contains transactions, a unique hash of the previous block and block hash itself. The transactions are hashed and hash id is labeled on the block
  3. Two or more function cannot produce the same hash output
1 Like

Describe hash functions with your own words.

  • Has functions are one way mathematical functions used to show proof of work on the blockchain.

    How are hash functions used in cryptocurrencies like bitcoin?

  • Has functions are used to ensure proof of work when mining bitcoin and promotes a fair and even release of bitcoin relative to the hash rate of the miners. They are cryptographically secure since they are one way, and cannot be feasibly reversed.

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

  • The more collision resistant a hash function is the more difficult it is to find two inputs that hash to the same output. This is important in cryptocurrency as it could present a variety of issues if collisions were found. While not impossible it is infeasible/insignificant.
1 Like

Hash function is a oneway encryption of any information. Small changes in input will lead to a different hash, output.
Every block is hashed, a link is made between the latest and the newest block in the blockchain where the header of the older block is also hashed. guaranteeing that nothing can be altered in the history of the blockchain
sometimes it is possible that different inputs lead to the same output. This may not lead to any mistakes or fraud because they are hard to find

2 Likes

A hash function is a function that takes a string for a input and gives you an output 256bits long, you can obtain an output from an input but you can’t obtain an input from an output. it has the property that tiny changes in the input make big changes on the output.

Hash functions are used to write new transactions into the blockchain through the mining process.

We mean that two different inputs should not have the same output, but it is not true, collisions do exist, why is that? It is because the number of possible inputs are bigger than the number of possible outputs which are limited to 256 bits length, so we agree that collisions do exist, but how probably is that to happend? To have a probability of 99.8% to find a collision, we should hash 2^130 times, that is why we think that it needs to be resistan cause it is possible but infeasible.

Bonus: i recommend to watch this video for more information

Cryptographic Hash Functions

2 Likes

Describe hash functions with your own words
a hash function is a function that can be used to map data to 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).
creating address, used to write new transactions into the blockchain through the mining process.

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 is if it is hard to find two inputs that hash to the same output.

1 Like
  1. Describe hash functions with your own words

A hash function is a function that when given a unique input it will produce a unique output. A hashing function cannot be reverse engineered to determine the unique input from a unique output.

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

In a cryptocurrency like bitcoin a hashing function is used to prove the integrity of the blocks within a chain. Each block containing the hash of the block before it and a double hash of all the transactions that will be accepted by the network when this new block is broadcast concatenated with a randomly generated nonce. If this double hash is less than the difficulty level than the block is valid and added to the blockchain.

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

For a hashing function to be collision resistant, for every unique output there must only be one or very few unique intputs that force that output. The probability of multiple inputs creating the same output have to be extremely small this helps prove provenance.

1 Like
  1. Hash functions have to main characteristics. One is that for each unique input there is always a unique output and the second is that they are one way only, meaning, that we can always produce the same output from the same input but we can not figure out the input from the output. So, we can go from Input to Output but not from Output to input.

  2. We use Chryptographic hash functions which is a special class of hash functions that have especial properties that make them ideal to use in Cryptography. These properties are:
    1 -Deterministic
    2 -Quick computation
    3-Pre-image resistance
    4-Small changes in the input changes the hash
    5 -Collision Resistance
    6 -Puzzle Friendly

  3. Collision Resistance means that for the most part the hash of input A will always be different to the hash of input B; “for the most part” meaning that it is infeasible for the two hash outputs of value A and B to be equal. No hash function is collision free, but it usually takes so long to find a collision. So, if you are using a function like SHA-256, it is safe to assume that if H(A) = H(B) then A = B. That’s because SHA-256 produces a 256 bit hash, a great number so you avoid collision, that’s because you have 2^256 different possibilities.

1 Like

This is correct, but what are the practical use cases for hash functions on Bitcoin? :wink:

1 Like

1.) Hash function encrypts in a way so each input will result in the unique output that won’t be able to decrypt backward way of as it was encrypted
2.) Hash functions in Bitcoin are used in a “block hashing algorithm” when miners proceed new transactions / adding new blocks to the blockchain
3.) The collision-resistant means that situation such as “two different inputs hash the same output” might very hard to happen or most likely might not happen

1 Like
  1. Take data of any size and put it into a set of values.
  2. Used to write new transactions into the blockchain.
  3. Hard to find two inputs that hash the same output.
1 Like

1 - It’s a mathematical function that for each input converts into a unique output
2 - Hash functions are used to ensure immutability. It ensures that no block was altered.
3 - It means that two different inputs can’t produce the same output.

1 Like
  1. Describe hash functions with your own words
    Hash functions give the unique input a unique output. So they only go one direction, input to output but not output to input.

  2. How are hash functions used in cryptocurrencies like bitcoin? **Hash functions have a one way function, they’re complex, there are many types of hash functions the one that is used and relevant to us is BTC hashtag which is SHA256. This SHA256 hashtag is used to secure the information in a 256 bits length. This method of hash functions is also called Proof of Work, this keeps the data secure.

  3. What does it mean when we say that hash functions need to be collision resistant? A hash function is resistant to collision, each input that is produced needs to produce a unique output. Two or more inputs cannot have the same hash functions.

1 Like
  1. A hash function is essentially a unique digital fingerprint of a piece of data (each input gives it’s own unique output)
  2. In a Bitcoin transaction, the transaction is the input, giving it’s own unique hash (this would most probably include data such as amount, source, destination and time-stamp)
  3. You can’t have two hashes being identical because that would not contribute to the immutability of the system. They can’t “collide” (they can’t be identical).
1 Like
  1. Hash functions take a input and encode it into a specific length of characters depending on what length bit hash function is used.

  2. Hash functions are used in cryptocurrencies to secure transactions.

  3. We mean that it needs to be hard to find two inputs that hash to the same output.

1 Like

1.This function takes a string/message (x) of any length - process it through - to give a unique string/message of determined length ( 64characters in SHA256)

  1. Every block starts operation by reading the hash of the previous block. This way prevents from changing data in previous blocks, as the hash string of the new block would be totally different if the change would be made.

3.It means that 2 different inputs would not produce the same output. It is possible but it is really hard.

1 Like
  1. Describe hash functions with your own words.
    They are computations that take unique inputs and produce unique outputs. They are secure way of digital foot printing.

  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).
    SHA-256 is a hashing function used in bitcoin mining to hash all of the block and transaction data. Part of the consensus algorithm in bitcoin is to achieve the same validation through SHA-256.

  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).
    A function is collision resistant when it is hard to find two inputs that hash to the same output.

1 Like