Homework on Hash Functions - Questions

1- An Hash function take a specific input and send out a specific output.
2- in cryptocurency hash functions are used in the block hashing algorithm to write new transactions
3- Collision resistant it mean that is very hard to find 2 input that hash to the same output

1 Like
  1. a hash function is an code that is unique based on a input, if you change the input you will get a different hash, hashing is a way of cryptographying messages or payments
  2. payments will be hashed, that will make them not public to other people to watch what is in the payment.
  3. there can never be two of the same hashes at the same time because otherwise the chain could be disrupted.
1 Like
  1. Describe hash functions with your own words
    It is a function that give a specific output from a specific input. Changing a bit of input would result in totally different output. It is also infeasible to know what the input is even you know the 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 is used to store the data (transactions) as an input to secure the data.
  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).
    In order to prevent the chance of matching output to the input.
1 Like
  1. Hash functions are on way functions which operate under the principle that each unique input will create a unique output.

  2. Hash functions are used in the mining process of bitcoin. Inputs for the hash functions are unconfirmed transactions plus additional data such as time and previous transactions. To solve a block miners will combine inputs plus their own data. So the outputs will start with a series of 0’s determined by the hashing difficulty. More miners = higher difficulty, less miners = less difficult. The mining process takes a lot of computing power and guessing.

  3. Collision resistance is a property of cryptographic hash functions. A hash function has collision resistance if it is difficult to find two inputs that hash to the same output.

1 Like

Not sure what you mean by that :thinking: do you mean the transactions are encrypted using SHA256 functions?

1 Like

True, but what is their pourpuse in Bitcoin? :wink:

1 Like

Of course I am :wink: haha

1 Like

This is not what a collision is. The collision in hash function is the possibility of to inputs resulting in the same output hash :slight_smile: you will learn how orphan blocks occur in further lessons :wink:

1 Like

Not exactly, you can track everything on the blockchain. It is true that transactions are hashed so you get the transaction id. But there is another more important use for hash functions.
Can you guess what it is? :wink:

1 Like

That is a property of non reversible functions :slight_smile: collision resistance means the possibility of getting the same output from different inputs :slight_smile:

2 Likes

Hash functions are one way functions, meaning that it should be infeasible to be able to determine the input from a given output. So each output is like a unique ā€œdigital fingerprintā€ for its input.

Special types of hash functions are considered cryptographically secure if they have 6 properties: deterministic, quick computation, pre-image resistant, a small change in the input drastically changes output, collision resistant, and puzzle-friendly [using H(k|x)=y, given the output y, if k is chosen from a distribution of high min entropy it should be infeasible to find x]. Bitcoin for example uses the SHA-256 algorithm.

It means that generally speaking you should not have two inputs with the same output, that would be a collision. No hash function is completely collision-free but the amount of time it would take to have a collision makes the issue negligible, hence ā€œcollision-resistantā€

1 Like

Oops I realized I wasn’t very specific with SHA-256 and BTC. It is used in mining (SHA-256 used as proof of work algorithm) and in generating BTC addresses

1 Like

…the output of the hash function is used to encrypt the input, which is a transaction in bitcoin? I think.

  1. Hash functions allow you to go from a unique input to a unique output - a digital fingerprint.

  2. Hash functions are used to add a hash value to each transaction and block on the blockchain. Hash functions, including the nonce, helps to speed up or slow down the speed of computation and adding blocks to the blockchain.

  3. Hash functions need to be collision resistant so that two hash values are not equal.

2 Likes

Hash is mathematical function which generates unique results from very source of unique data.

Bitcoin uses hashing to produce unique results which can only be replicated with original data.

Getting results for different input sources can be conflicting and can also render data useless. With hashing function two inputs having same hashing digest is difficult.

1 Like

1 Describe hash functions with your own words

A hash function is a special algorithm that runs through a unique input of arbitrary length producing a unique output or hash that is of fixed length for that particular input. The slightest change in the input will leave the output totally different. Hash functions always flow from input to output but never the other way around even if the output is known.

2 How are hash functions used in cryptocurrencies like bitcoin?

BTC uses the SHA-256 algorithm on the blockchain because of its significant and complicated properties. These properties have a unique hash value meaning that for every unique input a unique output is produced. It has a fast computational speed and a secure hash function that is infeasible to reverse.

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

When we say that hash functions need to be collision resistant we mean that is hard to find two different inputs that result in the same hash.

1 Like

That is correct. In my notes I show SHA-256 is used in Bitcoin.

Thanks,

J.R.

Ans.1) Hash functions are mathematical equations that are performed through a unique one way path, that is input through to output. These hash functions are able to handle any size data sets, on input, of letters and numbers, converting them to a fixed size encrypted output. As a consequence of an input, the hash creates a unique output known as a digital fingerprint. This digital fingerprint, or hash, is a one way path and provides a layer of security protection for that data. This data is intended only for one recipient. This hash created now provides security against manipulation or modification of that hashed and encrypted data.
Ans.2) Hash functions used in cryptocurrencies perform algorithmic mathematical equations upon input of data sets of numbers and letters, of any length, in which during that process of hashing, whilst fixing the final output size of the hashed encryption data sets. (eg. Bitcoin protocol = Secure Hashing Algorithm - 256 bit)
Ans.3) The property of a hash function is to be collision resistant. Basically, in hash function computing calculations, it is highly improbable, but not impossible, for two variable inputs to collide. In order for the hash function to achieve this collision resistant state, the minimum requirement of its bit length must be 160. Bitcoin protocol hashing function is 256 bit for its collision resistance.

Collision resistance does not mean that no collisions exist; simply that they are hard to find. Collision resistance is the property of a hash function that it is computationally infeasible to find two colliding inputs. A minimal requirement for a hash function to be collision resistant is that the length of its result should be 160 bits (in 2004).

1 Like
  1. A hash function takes an input and produces an output of a specific length. The same input will always produce the same output, but the slightest change of the input will result in a completely different output.

  2. It is used for several parts in bitcoin. One way is to make the chain immutable. It is done so by having each block contain the hashed output of the previous block. That means if someone were to change a certain block, then all blocks after that would be invalidated. It is also used in mining where new blocks are produced. A nonce is appended to the hash of the block (of the new block or the previous block? I dont know) and then hashed again. If this output is less than the difficulty it will be accepted by the network.

  3. It means that 2 different inputs should not produce the same hash output. It should be infeasible/extremely unlikely, but not impossible.

1 Like

1-Hash functions are functions that for every single input will give you a unique output.

2-The transactions are taken as input and run through SHA-256 wich gives an output of a fixed length.

3- The hash functions need to be collision resistant because if for 2 or more inputs you can get the same output, the outputs are not unique anymore, and this is bad, it could appear that someone digitally signed a document that they did not in fact sign.

1 Like