Homework on Hash Functions - Questions

There are more parameters that are used as an input, for example the merkle root of transactions and x is the previous block hash. But other than that you are on track! :slight_smile:

1 Like

Hash functions are a mathematical language to control specific inputs and outputs. They can work both ways, but the more secure hash functions only go from input to output and not in reverse.

Hash functions are used in crypto to secure the chain of transactions. As you go along the chain and each transaction is built upon the next you can identify if something has been altered in anyway.

No two inputs will result in the same output

1 Like

1-A hash function is a process where each input transforms into a unique output. This makes infieasible to determine the input.
2- Hash functions are used to give each input a unique output, this way every transaction have a different hash value and the hash value its unrepeatble. This gives security to the net.
3- It means that we have to make them impossible to repeat!

1 Like
  1. Describe hash functions with your own words
    It is a way to encrypt various inputs into a unique output that cannot be reverse engineered.

  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).
    It is used to summarize a large set of inputs into one specific hash. In Bitcoin’s case, it is to summarize a set of transactions done in one block. This is used so that it is infeasible for anyone to alter the data without completely changing the hash. It is used for efficiency, security, and immutability. It is also used for mining new blocks on the Bitcoin blockchain. Miners are incentivized to create new blocks that meet the difficulty level set forth by the protocol. And because this requires work and processing power, they are rewarded for their work to keep the blockchain going and alive. This kills 2 birds with one stone: it incentivizes miners to keep Bitcoin’s blockchain alive, while also making it secure and extremely hard for people to brute-force their way to tamper with 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).
    It means that different inputs should not be able to (or at least easily) end up with the same output. It has to be collision resistant so that the blockchain does not end up with the wrong input.

1 Like
  1. Describe hash functions with your own words

Hash functions are functions/mathematical processes which will give to each unique input of any length an unique output and this output is the fingerprint of the input. Unlike normal functions, hash functions are a one way function which goes from input to output, but the other way around is impossible.

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

Hash functions are used in cryptocurrencies like bitcoin to write new transactions into the blockchain

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

Hash functions need to be collision resistant so there will be no 2 inputs that will give the same hash output, otherwise hash functions will lose the property that every unique input will give an unique output.

2 Likes

What do you mean by making them impossible to repeat?
A collision is when 2 different inputs produce the same fingerprint (hash)
In Sha256, it’s nearly impossible to have a collision, because 2^256 is a very high number.

3 Likes
  1. Describe hash functions with your own words

Hash functions are a single way function to create an output from a input, without being able to determine the original inputted data from the produced data.

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

The hash functions are used to save time and space to verify all the transactions in a block. They are condensed into a string, then hashed, then concatenated with a nonce and then hashed once more until it is less than the difficulty target set by the system (determined by the amount of miners at a given time). Subsequently, block sizes are smaller and it speeds up the efficiency of verification across all the nodes in the network.

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

Each output has it’s own unique hash. 2 inputs with the same hash is what is known as a collision. Therefore, collision resistance requires a function to be collision free - but with the understanding that this is impossible but incredibly unlikely to occur.

1 Like
  1. It’s a function that generates unique value or values from an input to output.
  2. Hash functions are used in cryptocurrencies like bitcoin to write new transactions into the blockchain. The mining process validates each transactions.
  3. Collision Resistant means each input will have it’s own unique hash. If there are two different inputs with the same has then it is NOT collision resistant because they will cause an “accident”.
1 Like

1.Hash function is one way function, when a unique input give you a unique output.

2.In Bitcoin hash function is used to Hash transactions in block. Transactions and another data are inputs.
Miners try to find correct hash. Whoever find it firs, add the neblock into blockchain and get reward…

  1. Colision resitance : is very hard to find two different inputs wich give you same hashed output.
1 Like

Homework on Hash Functions - Questions

  1. Describe hash functions with your own words
    Any function which converts an arbitrary input into a unique about meeting the output criteria of that particular hash (e.g. 256 bit 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 in (1) the building and security of the blockchain, and in creating the public and private keys for individual wallets. For blockchain construction, a block stores the hash value of the previous block. By rehashing the previous block and comparing it to the stored value, one can determine if the previous block has be altered. And since prior blocks contain the hash of its previous block, this also determines whether any previous block has been altered with a single test.
  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).
    It means the likelihood that the hash of two different inputs hashing to the same output is extremely unlikely. This means that the odds of incorrectly validating an altered block/blockchain is also extremely unlikely.
1 Like
  • Describe hash functions with your own words
    hash functions are one way functions that can only go from input to 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 part of the algorithm used in bitcoin - sha256

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

1 Like
  1. Describe hash functions with your own words
    Hash function is a one-way function with a unique input and gives a unique fingerprint 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).

Hashing algorithm is used to write new transactions into the blockchain through the mining process. It’s the need for this large amount of processing power that means new bitcoins get mined over a long period of time, not all at once.

  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 not 2 different inputs cant have the same output.

1 Like
  1. A Hash Function is basically when you give an input and the output is so unique it cant be replaced.
  2. In bitcoin we use Hash functions to keep track of all past transactions.
  3. Collision resistant means that 2 hashes cant be identical or even similar or they could be at risk of collision
1 Like
  1. A hash function is a one way function (you can’t recover input by using output). Every unique input (length doesn’t matter) will give a unique output of a fixed length (64 digits). If you type an input, the output will always be the same, but with a slight difference in the input, the output will be completely different (same length).

  2. Hash functions are used to mine new blocks on the blockchain and also to keep track and verify old transactions on the chain.

  3. Collision resistance means that two different inputs can’t result in the same output, this could although happen theoretically but the odds are astronomical.

1 Like
  1. A hash function converts a block of data into a string in such a way that this string becomes a unique identifier (aka a fingerprint).
    For example, SHA256 convert transaction data on the Bitcoin blockchain into a string composed of 64 hexadecimal characters.

  2. In the blockchain, the next block stores the hash of the previous block. The hash function effectively converts the transaction data into a string (e.g. 64 hexadecimal characters for SHA256 algorythm), which gets referenced in the next block.
    Hashing is great for security. The hashing function makes it impossible for the transaction data to be modified without altering the hash. This in turn has a cascading effect on the other blocks which reference each other, resulting in the changes being rejected by the network.

  3. A “collision” occurs when 2 different inputs in a hash function result into the same output (i.e. the same hash). A collision-resistant hash-function should have extremely low probability of this happening, as it would create confusion.

1 Like

We use the elliptic curve function to derive public keys, but the public key is hashes to get the address :slight_smile:

1 Like

Can you give an example how hash functions are used in Bitcoin? :wink:

1 Like

1 Hash functions take a given input, coverts it via a formula, then gives an output. It is one-way meaning if you have an output it is impossible (or very difficult) to work backwards to find the original input.

  1. To ensure the data written on the blockchain is immutable and can be trusted by users. No central authority can change the values without affecting the entire chain and having other users notice this also.

  2. So that two miners do not come up with the same output, resulting in wasted computational power and large numbers or orphaned blocks.

2 Likes
  1. A hash functions is a one way of a specific output for a very accurate data, you can’t reach to the main data by from the hash itself. each hash represents a finger print for a very specific data.

  2. When a transactions happen on BTC’s blockchain, a 64 digit code(SHA-256) will be created specifically for that transaction. A miner in the network will create that hash, the hash is holding part of the previous block code as well, which is why they are all linked.

  3. Collision resistance requires not same outputs for 2 different inputs, so it means every output can only be used for one specific data and not a different data.

2 Likes
  1. Describe Hash functions in your own words
    Ans: A Hash function is a one-way function that uses cryptography (such as SHA-256) to produce it’s output.

  2. How are hash functions used in cryptocurrencies like bitcoin?
    Ans: Hash functions are used in cryptocurrencies for the purpose of mining.

  3. What does it mean when we say that hash functions need to be collision resistant?
    Ans: It means that hash functions have the property such that for every input, there is only one unique output.

2 Likes