Homework on Hash Functions - Questions

Hash functions are not used for deriving public keys. We use the elliptic curve function to do that. :slight_smile:

1 Like

Transactions are only hashed to be used in the merkle root calculation which is then used as the block hash calculation to make them immutable. Beforehand the UTXOs used as inputs to the said tx is signed with the private key to unlock the funds. :slight_smile:
Note that public keys are not hashes of private keys but are derived using a different formula.

2 Likes

Mining is not the same as brute forcing. In brute force you are trying to find an input to a hash that has a specific value while in mining you are searching for a new hash under a specified target. :slight_smile:

2 Likes

I don’t think this has ever happened in BTC before, If it would it would probably be time to hard fork to a new algo because SHA256 would completed its usefulness. :slight_smile:

2 Likes

1.- Hash function are a mathematical function that creates a unique output for a unique input. They are one way functions.
2.- Hash functions are used in Bitcoin to create immutability. So that a block with defined transactions cannot be modified. It is also used in the process of mining.
3.- Collision resistance is a property of hash functions that avoid that two different inputs create the same output.Failed collision resistance will be A ≠ B, but H(A) = H(B)

1 Like
  1. Hash functions create a digital fingerprint for every unique input, one minute change in the input will result in a different hash

  2. Has functions are Deterministic and can reference all transactions in a given block, is immutable, so lock up transactions and provides a reference point for transaction verified within the block.

  3. So only input A=H(A) and input B=H(B) any change in input A will result in a completely new Hash©  And you can’t reverse the equation and determine input A, B, or C from analyzing the given Hash

1 Like

Oh yes you’re right. I had also the addresses in mind when I wrote that. But anyways I always get confused because, in a way, the elliptic curve function kind of shares the same characteristics than a hash function, right? It’s deterministic: same input, same output. It’s collision resistant: 2 different PKs, 2 different Pubs. It’s one way: you cannot figure out the PK if you know the Pub. It’s just that the elliptic curve provides more than a hash function (encryption and signature). Is that right, or I’m missing something?

  1. hash functions are used to put any kind of data no matter how big or small into a unique hash 64 characters.

  2. hash functions are used in crypto to validate transactions on the block and thru the usage of hash functions you can also play with the difficulty of the hash rate this way bitcoin is made to not overmine bitcoin.

  3. this means that it should be infeasible to to find the same output from two different inputs. this is very important in bitcoin because it’s a really good securety.

1 Like

They are fundamentally different in regard that Elliptic curve is used for deriving public keys and generate signatures and to encrypt/decrypt messages.
Hash functions on the other hand are used to generate fingerprints of data that anyone can input and recalculate the hash, not only the ones that have either public (to verify signature) or private (to decrypt) key. :slight_smile:

1 Like
  1. Functions that give an output for an input but cant be reversed.

  2. Each block contains the hash of the previous block which means that if you change the end block you change all blocks which just doesn’t work.

  3. Means that two inputs will have the same output. (On rare occurrence.)

1 Like
  1. Describe hash functions with your own words
    Irreversible function that produces a unique digital fingerprint.

  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).
    When mining, hash functions are used to add new transactions to
    the blockchain.

  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)
    Collision resistant means that each input will have its own unique
    hash so that no 2 inputs with the same hash.

1 Like

Okay, Whatever that is

Q1 Describe hash functions with your own words

A1: Hash functions return a unique 256 bit value (fingerprint) for a specified string input.

They can be referred to as “one-way” functions since it is almost impossible to determine the value of an input from the ‘hash’ output - aka processing of 'reverse hashing’

Q2: How are hash functions used in cryptocurrencies like bitcoin?

A2: Cryptocurrencies like Bitcoin use blockchain and hashing technologies providing an exceedingly high level of security.

Each blockchain is a linked list of transactions (blocks) and the processes of storing the hash of each previous block prevents them from being tempered with.

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

A3: Basically, a hash function is collision resistance if it never creates (outputs) the same “hash” for two or more given unique inputs.
In other words, the output (hash) is always unique for each and every unique input.

Reference(s):

1 Like

Hash Functions

  1. Describe hash functions with your own words
    Hash functions take input of variable length and deterministically output a string of fixed length. This process is irreversible, such that it is very easy to get to the output (i.e. the hash) from a known input but very hard (ideally impossible) to get to the original input from a known output. Any unique input is supposed to generate an equally unique output and this avoid collision.

  2. How are hash functions used in cryptocurrencies like bitcoin?
    In the case of Bitcoin the SHA-256 is used as one step in the creation of new addresses and also lies at the heart of its proof of work algorithm.

  3. What does it mean when we say that hash functions need to be collision resistant?
    Collision resistance of a function means that it is extremely unlikely to find 2 inputs to that function that have identical output. Such a collision would, for example, break the important notion of each newly created Bitcoin address being unique.

1 Like
  1. Hash functions use a unique input and produce unique outputs based on the exact input, slight changes in inputs will drastically change the output. Making it hard and nearly impossible to go from output to input.

  2. Hashing functions are used to verify and add new transactions to the blockchain.

  3. Hash functions need to be collision resistant because of the “birthday paradox”. It seems very unlikely but it could be possible to have two of the same inputs that could produce the same output, so we need to avoid this by using collision resistant hash functions.

1 Like
  1. Describe hash functions with your own words

Hash functions are a tool used to create a unique ID output for a specific input. You are not supposed to be able to deduce the input from the output, and 100 percent of the time the same in put will give you the same output and 100 percent of the time a different input gives you a different output.

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

It is used to mine new transactions on the blockchain. The new transaction is the input and the out put is the hash.

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

Collision resistance means that you will find it impossible or near impossible to find two different inputs to give you the same out put.

1 Like
  1. Hash functions = a function that is used to generate a unique code (hash) that represents an input value of any length. The input can be any size - the output is always the same size. A hash function can only work one way - input to output - you can’t figure out the input based on the output of the hash function. The output will always come out the same if given the same input - if a slight change is made, the output will be totally different.

  2. Hash functions are needed for Proof Of Work in Bitcoin - also used for generating crypto wallet addresses and passwords

  3. Collision resistant = the hash function should be so complex that it doesn’t produce the same output hash for any two or more random inputs - making it collision resistant.

1 Like

1-> a Hashfunction converts input to a unique fingerprint output but can`t reverse from the unique fingerprint output to the original input
2-> to secure the string of blocks on the blockchain, when someone or something try to change the data in one of the blocks the hashfunction changes and changes all the hashfunctions in the blockchain and then the nodes are coming in to play
3-> the possibillity that 2 different inputs get the same output / hash

1 Like
  1. A hash function is taking a data input and creating a unique output that represents the original data.

  2. Hash functions in Bitcoin are used to verify and record transactions and create Bitcoin addresses.

  3. Collision resistant means that 2 different inputs do not get the same output.

1 Like
2 Likes