Homework on Hash Functions - Questions

1- A hash function is a function that can take an input of an arbitrary size and get a fixed output.

2-In cryptocurrencies like bitcoin, transactions are used as an input and the output of a fixed length will be obtained using the algorithm: SHA-256.

3-This means that hash function should not have two different input that produce the same output.

1 Like
  1. A hash function takes any string of data and converts it into 256 bits. This process is impossible to reverse and provides a unique identifier for your data.
  2. In Bitcoin the Hash function is used to hash transaction data. Also mining and finding a nonce requires finding a number that generates a specified hash in combination with data unique to that block.
  3. Collision resistant means two different things not getting the same hash.
1 Like
  1. Describe hash functions with your own words

Hash functions are algorithms that calculate a uniqie value with a fixed bit lenght. In case of SHA 256 it is 256 Bit long. There is no way to determine the input value backwards. If only a single bit in the input value would be changesd, the reult of the hash function would be completely different.

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

In cryptocurrencies like Bitcoin hash funktions are used during mining and on transactions in the Blockchain. In mining there is a number to be found that generates a special hash which starts with a certain number of 0 digits combined with the haash of the hash of this block. This is very computing power consuming task.

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

This means that it is hard to find two inputs that as result would show the same output hash.

1 Like

1- A hash function is a one-way computational function that takes in a string of text and generates a unique output
2- In cryptocurrencies, Hash functions are used to generate new transactional hashes that added to the chain via the mining process
3- Collision resistance is the property of a cryptographic hash function that makes it infeasible to have 2 separate inputs hashing the same output

1 Like

Homework on Hash Functions - Questions

  1. Describe hash functions with your own words

A hash function is a tool used to produce a unique hash of a fixed length for any string of data or arbitrary number. A hash is a one way function and cannot be reversed.

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

Hash functions are used in Bitcoin to hash the transactional data contained in the previous blocks, it is also used to combine the transactional data with the nonce and time stamp.

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

This means it is hard to find two find two input that hash together to make the same output. Not impossible but hard.

1 Like
  1. Hash functions are functions that you pass a unique input and it returns a unique output. With hash functions it is not possible to go from output to input.

  2. With bitcoin the transactions are taken as input and run through the hash function/algorithm (SHA 256) which gives an output of a fixed length.

  3. This means that the probability of two different input giving the same output is highly unlikely.

1 Like
  1. Describe hash functions with your own words

Hash functions are one way functions in the sense that it can be provided with an input that will be converted to an output. It is almost impossible to obtain the input from the output. Hash functions gives data (input) a digital finger print (output) seeing that each unique input the has function is given a unique output is provided.

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

With Bitcoin, transaction data is stored on what is known as blocks. Each block has a unique hash provided through the SHA-256 hash algorithm. Even a slight change in the data will cause the hash of the block to change. Each block contains the previous blockā€™s hash. If the hash of a block changes it breaks the chain in the block cain rendering the block invalid.

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

Having two different inputs providing the same output is known as a collision. No hash function can be 100% collision free. For a hash function to be collision resistant there has to be a very low probability for a collision to occur.

1 Like
  1. Hash function is a security for your network and it is an easy way to check if someone did not change the input.

  2. Hash is a mathematical operation that used for proof of work what is the vital component in consensus. When a miner solves the math true nonce. Then itā€™s send as a block and the other miners check iff the hash is correct and then itā€™s added to the chain of blocks(blockchain).

  3. When itā€™s not colusion resistant it means that 2 inputs can get the same out put. Iff that happens You kind off destroy the concept. Thats why it is important that the hash function needs to be collision resistant

1 Like
  1. It makes Unique fingerprints

  2. It is infeasible for a hash function with one input to be equal with a different input

1 Like
  1. Hash functions are one way functions that delivers an unique output for every input, also called unique digital fingerprint.

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

  3. Hash functions are collision resistant when it is hard to find two inputs that hash to the same output.

1 Like

Homework on Hash Functions - Questions

  1. Describe hash functions with your own words

Hash function is unique code which you get as output from input.

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

In simple terms, hashing means taking an input string of any length and giving out an output of a fixed length. In the context of cryptocurrencies like bitcoin , the transactions are taken as input and run through a hashing algorithm ( bitcoin uses SHA-256) which gives an 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).

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 i , two inputs a and b where a ā‰  b but H(a) = H(b).

1 Like

What about its usecase in Bitcoin? :slight_smile:

  1. Hash functions are mathematical computations that take any input and convert it to a singularly unique string of numbers like a digital fingerprintā€¦ No two inputs will have the same output. And also hash functions are a one way street meaning you should not be able to determine an input from an output.

  2. Hash functions are used in bitcoin to secure the transactions and wallets and also mining the transactions and new bitcoin miners need to add there own data to the new transaction inputs and time stamp data etc plus pick a nonce out of thin air. Then hash all this and compare to the mining difficulty hash.

  3. Collision resistance means the unlikelyhood of two hashes being identical. It is so rare in this case that if it were to happen one could assume the two inputs by chance happened to be the same.

1 Like
  1. Describe hash functions with your own words.
    A hash function is an algorithm that takes input data and creates a string of numbers and letters from that data. It will always return the same answer or hash from the same data but if you make even the smallest change in the data, it will return a completely different hash. It is also one-way, meaning that you can not deduce what the original data was from examining the hash even if you know the the hash function.
  2. How are hash functions used in cryptocurrencies like bitcoin?
    Each block (except the ā€œgenesisā€ block) has two hash codes. One that is the hash of the block itself and one that is the hash of the preceding block. This is how you build a chain.
  3. What does it mean when we say that hash functions need to be collision resistant?
    This is the third property of hash functions after ā€œit has to be constantā€ and ā€œit has to be one-way.ā€ ā€œIt has to be collision resistantā€ means that different inputs canā€™t give the same output. For instance f(2X16)=32 has the same answer as f(4X8)=32 even though these functions have no integers in common. So far SHA-256 has never had a collision.
1 Like
  1. Hash functions are a special, one-way functions that for any input value will produce a unique output value at a fixed length.

  2. Hashing is central to cryptocurrencies like Bitcoin. Blocks are hashed and linked together, and thatā€™s what makes blockchain a secure chain of blocks. Also when miners try to produce a block, it is hashed along with a nonce, and that value must meet the difficulty threshold. They keep trying until they get it, and the electricity that they spend is the proof of work that secures the network.

  3. Collision resistant means that the hash function should produce unique outputs, by and large. If the parameters are set to produce an astronomical number of possibilities, it will take a virtual eternity to produce a duplicate output based on differing input.

1 Like
  1. Hash functions are functions to take date and enter it into the function to get an output. This output will be infeasible to reverse the process back to the original data information.
  2. The most important hashing example in bitcoin is the relationship of your private key, public key, and bitcoin address. Addresses are hashed from Public keys and public keys are hashed from private keys. All are used to verify you have the funds to send from a specific address or have a location to receive funds, but at the same time keeping private keys secured so others canā€™t use it.
  3. Hash functions need to collision resistant so two different sets of input donā€™t create the same output. For example, if this happens with address, it can lead to one owner creating transactions on anotherā€™s address. Sending or receiving.
1 Like

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