Homework on Hash Functions - Questions

Describe hash functions with your own words

Hash function is like a one-way street. A course of action that cannot be undone or does not lead to reciprocation.

How are hash functions used in cryptocurrencies like bitcoin?

Bitcoin’s proof of work algorithm is based on SHA-256. Using this, Bitcoin miners solve computationally difficult math problems to add blocks into the blockchain.

Bitcoin blocks are added by verifying the hashes on a lottery basis. Yes, a lottery!! Let see how a miner wins the lottery…

To successfully mine a block, a miner needs to hash the block’s header in such a way that it is less than or equal to the “target”.

The target is that the SHA-256 hash of a block’s header must be a 256-bit alphanumeric string, and must start with 18 zeros. The target changes as the difficulty change every 2016 blocks.

And the miners arrive at this particular hash (or target) by varying a small portion of the block’s headers, which is called a “nonce.” A nonce always starts with “0” and is incremented every time for obtaining the required hash (or target).

Since the varying of the nonce is hit and miss, the chances of getting this particular hash (or target), which starts with these many zeros, is very low. Therefore, many attempts must be made by a miner by varying the nonce.

And this requires an enormous amount of computational power and hardware resources which proves that a large amount of work is carried out before mining any individual block. That’s why this is called “proof-of-work “.

And in this way, whichever miner first obtains the correct Bitcoin Hash will win the lottery and get the block reward of 6.25 BTC

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

In practice, hash functions are used for “digesting” large data. For example, if you want to check the validity of a large file (potentially much larger than a few megabytes), you can check the hash value of that file with the expected hash. Therefore, it is desirable (especially for cryptographic hash functions) that the function is collision resistant. That is, it should be “hard” to find two inputs m1 and m2 for hash function h such that h(m1) = h(m2). Most modern hash functions hope to achieve security level of 264 or better, which means that the attacker needs to test more than 264 different inputs to find a collision. Unfortunately, MD4 and MD5 aimed to provide 264 security, but has been shown to be broken using 26 and 237 inputs respectively. SHA-1 aimed to provide 280 security, but has been shown (at least theoretically) to be no more than 261 security.

1 Like

Describe hash functions with your own words
the function if the program to get an input it will give you an unique out for it .it is also known as digital print.
How are hash functions used in cryptocurrencies like bitcoin?
Hash function is used by miner for all new transactions,it also help to keep the whole process secure.
What does it mean when we say that hash functions need to be collision resistant?
it means that two different different input cant have the same hash it is impossible mathematically those to be the same.

1 Like
  1. Describe hash functions with your own words
    Functions that are able to transform an input into a specific output. But not the other way around.

  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 for transactions taken as input and we get a specific output.

  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 2 wont give the same resutls at the same time.

1 Like

1.A hash function is a function that always produces a unique output from a unique input without any collision. A slight change in the input can cause a massive change in the output.
2.A hash function in Bitcoin is basically use for encrypting data transaction(hashing transaction data). It is also used in mining and finding a nonce.
3.Collision resistant means that in a hash function, the encrypted data will be nearly possible to be duplicate (it is still possible but the percentage is astronomically low). In lay mans terms, it is very hard to produce 2 same output from different inputs.

1 Like
  1. Describe hash functions with your own words

hash function is a unique ouput given from an input. this output cannot be duplicated.

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

they ve been used to create unique coin units that cannot be duplicated or interefed.
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).

colliion resisteant means the hash cannot be modified , hacked or altered.

Yes, but keep in mind that this is not by using Sha256. Public keys are calculated using ecdsa eleptic curve cryptography. And to calculate a bitcoin address you kind of double hash the public key with a prefix and a checksum.

Check this post where it describes the process in detail:

1 Like

Collision resistant means that it should be almost practically impossible for 2 different inputs to produce the same hash

1 Like
  1. Hash functions are unique inputs that give a unique output. Example is SHA-256 Base 16 code.

  2. Hash functions in Bitcoin help to create unique wallet addresses. Each transaction is hashed using SHA-256 for Bitcoin and then stored on the ledger which cannot be changed.

  3. Collision resistant means there is a very LOW chance of different inputs creating the same output.

1 Like
  1. Function that creates a unique output of a given input that cannot be reverse

  2. Bitcoins uses SHA-256 hashing algorithm to to take an input string of any length and giving out an output of a fixed length (often called the digest).
    Hash functions are used in Bitcoin mining by solving problems like H(S) needs to start by X times the number 0 before both being granted the Bitcoin rewards & having the responsibility to lock the block in the blockchain.

  3. Collision resistance is a property of cryptographic hash functions: a hash function H is collision- resistant if it is hard to find two inputs that hash to the same output; that is, two inputs a and b where a ≠ b but H(a) = H(b). … Cryptographic hash functions are usually designed to be collision resistant.

1 Like

Hash functions are not used for deriving public keys and a private key is just a random number. However the public key is hashed to get the address :slight_smile:

1 Like

Sorry still learning. This stuff is extremely confusing. I do not have any background in this.

1 Like

Don’t worry, you will learn :wink: Keep up the good work! :raised_hands:

2 Likes
  1. A hash function takes a string of date of any length and converts it into a string of data of a fixed length. This enables large amounts of data to be stored efficiently on the block chain. In the case of bitcoin, the output string is 256 bits.

  2. Hash functions in bitcoin are used to provide information security and allow bitcoin to remain decentralised and secure. Bitcoin hashing properties include efficiency, collision resistance, pre-image resistance and randomness by using complex mathematical calculations. Hashing is essential to bitcoin mining because it allows the proof of work algorithm to function. The hash function is applied once to confirm if the miner did the required amount of work and if the solution is good or not.

  3. Collision Resistant refers to the need to ensure as far as possible that two different inputs will not produce the same output. This is especially important to prevent double spending.

1 Like
  1. A hash function has a unique input and will produce a unique output, it’s not possible to go from output to input, then it’s broken.
  2. Hash functions in cryptocurrency are used for many things, such as a public key, private key, transactions etc.
  3. Collision resistance is a property of cryptographic hash functions: a hash function is collision resistant if it is hard to find two inputs that hash to the same output; that is, two inputs a and b such that H(a) = H(b). Every hash function with more inputs than outputs will necessarily have collisions.
1 Like
  1. Describe hash functions with your own words
  • It is a mathematical function which protects the BTC. It takes any length of data as an Input and create unique Output.
  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).
  • For BTC we are using SHA - 256 function and we take the transaction as an Input and we get output of a fixed length.
  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).
  • Means that it can happen to have 2 different Inputs but with the same outputs. In this case we have a collision. But the probability of this is too small like the brute force of the hash to find out which output is the exact input.
2 Likes
  1. Describe hash functions with your own words.
    Hash functions are formulas where you can input something and you will receive an output. All outputs are a set standard length. The same input will always result in the same output but if any small change is made to the input the output is completely changed. You can not figure out the input by only knowing the output.

  2. How are has functions used in cryptocurrencies like bitcoin?
    In bitcoin, hash functions are part of the block hashing algorithm which is used to write new transactions into the blockchain through the mining process. Computers (miners) guess inputs to try to get an output that starts with a certain number of zeros. When this criteria is met, it gives the miner the right to mine that next block.

  3. What does it mean when we say that has functions need to be collision resistant?
    When two different inputs produce the same output, it is called a collision. Collision resistant means that the odds of this happening are very small so it is very unlikely (but possible) that two different inputs will produce the same output.

2 Likes
  1. A hash function is a computation that gives each unique input a unique digital fingerprint of the original data as an Output. With hash function you can only go from Input to Output and not the other way around, making it infeasible to know what the original Input was by looking at the hash output. Slightest change in the input changes the hash output completely.

  2. Each block in the blockchain contain hashes of the previous blocks, making it easier to validate that the data from the previous block haven’t been changed or modified. If any data in a previous block were to be modified the hash output would change completely and would be discovered immediately by other blocks, breaking the whole chain.
    When you make a transaction through Bitcoin blockchain, the data is encrypted through hash that gives you your unique transaction receipt. This makes sure that nobody can copy someone else’s transaction.

  3. Collision means that two different inputs generate the same output hash. Hash functions are not completely collision resistant but they are statistically insignificant. They need to be as collision resistant as possible as this improves security significantly.

2 Likes
  1. Hash functions allow you to create a unique hash for a certain type of input data. If anything changes within the input data the hash output will change.

  2. Hash functions are used in cryptocurrencies to keep the personal data private and secure by creating hash outputs.

  3. To be collision resistant means to avoid having the same hash output for different inputs.

1 Like
  1. A hash function takes any input and assigns an output to that input. a good hash algorithm makes it infeasible to determine the input from the output

  2. in blockchain each block contains the output data of the previous block, this is what creates the chain.

  3. with a large number in inputs there maybe instances where inputs have the same outputs, unlikely but probable. collision resistance does not mean that this does not happen just that it is unlikely too

1 Like
  1. Describe hash functions with your own words
    You start out life as a caterpillar; you follow instructions to the letter, climbing into your chrysalis; you come out of it all with a completely new look, a new everything actually. There is absolutely no going back. You are now, because you participated in this hash function, a butterfly.

  2. How are hash functions used in cryptocurrencies like Bitcoin?
    Hash functions make up the block hashing algorithm for cryptocurrencies like Bitcoin. This process is for putting transactions into the blockchain through the mining process. Bitcoin mining is about the inputs as a function of the most recent transactions. These are transactions that have not been confirmed.

  3. What does it mean when we say that hash functions need to be collision resistant?
    If a hash function is collision resistant, you cannot find two inputs that hash to the same output.

1 Like