Homework on Hash Functions - Questions

  1. Hash Function is the “chain” in blockchain. It references where the data comes from and what is in the block.
  2. These Hash Function make the “unlikely” to be hacked. If you input the same data through the Hash Function, you will always get the same answer. Therefore creating a deterministic result which is an necessary property of cryptography.
  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). … Collision resistance doesn’t mean that no collisions exist; simply that they are hard to find.

Hi there! Can you tell me an example where hash functions are used here? Thanks!

Hi Roberto! Correct, although I will say that they don’t create a unique input as you are the one that selects the input, but you will get a unique output, as you mention.

Yes, that’s the algorithm used in Bitcoin, but not exactly for creating the transaction itself, but for including them in the block, at the mining process.

Felipe.

1 Like

Yes, here we say that its used to encrypt data for communication systems. But can you tell us about what is a hash function? You can relate input and output.

Answer2 is correct for question 1 :ok_hand:

But where or where does Bitcoin use hash functions?

Yes everyone can look at a public key and they won’t be able to go back to the private key (Due to elliptic curve digital signature algorithm). But public and private keys have nothing to do with hashing. Private key is not an input and a public key is not an output. Public and private keys are used for asymmetric encryption.

Hash functions are not used in the public and private keys, they are used in mining. They secure the transactions in the bitcoin blocks. See if you can figure out how.

Public and private keys are used in order to authorize transactions from you wallet. (You will learn more about this later on.)

  1. Describe hash functions.

A hash function is a one-way function which converts a string of data to a fixed length output. It’s almost impossible to reverse without brute force. It provides a unique identifier to your data and is a digital finger print.
A hash generator (eg. SHA 256) is used to create a unique output.

  1. How are hash functions used in crypto such as BTC?

They’re used for mining new transactions on the blockchain. Inputs include unconfirmed transactions, time, previous transactions etc which result in a unique output. A lot of computer power is required to hash transaction data.
Miners secure the blockchain by hashing blocks.

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

All inputs must result in a unique output. SHA-256 is currently the most reliable and most used hashing function.

1 Like

An example used was like rolling a single dice and instead of getting a specific number when you roll, Instead you would get a hash value that corresponds to a specific number between 1-6.

So, to determine what the original number was, You would have to find out the hash for each number from 1-6 then compare it with your result .

1 Like

Hi Mark,

Message well noted, thanks for the correction. :nerd_face:

Learning as I go!! Thanks

1 Like

1 it takes a “word” an incrupt it to a string of numbers and leaters

2 verify new transaction in the blockchain

3 that two difrend “words” cant have the same output

1 Like

Thank you Mauro, thanks for clarifying once again. I’m now further into the lesson and i understand inputs and outputs are basically money received and money spent.

Also I understand hash functions are purely for securing transactions by miners.

1 Like

That is how brute force method works. But how does mining use hash functions? Why are they used in mining?

I am glad you managed to connect everything now. I know it can be tricky at start, since you start learning a lot of new terms. Keep up the great work. :wink:

Thanks for the correction. At the End it is a number. A string was coming to my head because I am not able to imagine a photo or video as a number :slight_smile:

1 Like

That is true. Imagine if we could turn photos into number in our head. That would be crazy. :rofl: :rofl: (Neuralink!?) I wouldn’t say I corrected you. Just added some interesting information. Your answers were pretty good and correct. :wink:

Homework on Hash Functions - Questions

  1. Describe hash functions with your own words

Hash functions can take any string as input and will always produce an output of bits, of a certain length, depending on the particular hash function used. The outputs are long integers, represented with standardized character systems, where letters are also used to represent numbers.

The outputs of hash functions can be described as unique digital fingerprints of data, set to a fixed length, to be able to utilize in a system.

The fingerprints (outputs) can never be used to see the original input. Digital fingerprints are therefore beneficial to use in cases where it’s relevant to verify if data has been changed or not.

  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 bitcoin, each block contains a hash of some of the data (the block header) in the previous block. This is called a hash pointer and is what makes up the structural concept of a blockchain in bitcoin. Because the hash pointer not only is made from a simple address/ID of the previous block, but also some of the actual data of the block, it makes the bitcoin blockchain very resistant to attacks.

Hash functions are also used for other purposes in bitcoin.

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

Hash functions are collision resistant when it’s difficult to find two inputs that creates similar outputs. It’s important that cryptographic hash functions are collision resistant when they are used to create fingerprints of data.

1 Like
  1. Hash are one way functions which transform input text to unique output.

  2. are used to encrypt the transaction data so its secure and only the intended recipient can decrypt it.

  3. Each input is transformed to unique output and probability of two different inputs transforming to same output is infeasible if not impossible.

1 Like

I am a little confused about you follow up question. There are two "where"s in the sentence and I’m not clear on the meaning.

Please resend?

Minners use Hash Functions like sha 256 as secure way to mining transactions for the blockchain

1 Like
  1. Hash functions are functions that take an input of any size and output a string of a fixed size that is essentially unique to the input, and from which one cannot derive the input, resulting in the encryption of the input.

  2. Hash functions in bitcoin are used to secure the network:

  • by ensuring that a certain amount of energy is required to add a block to the network, and that the network is a public one, through its puzzle friendly property;

  • by practically ensuring that data added to the blockchain cannot be removed, nor altered, through its pre-image resistance property and collision resistant property; and

  • by ensuring that data expressed on a block in the blockchain is encrypted.

  1. It means that practically, it should not be possible to generate the same hash output from two different inputs, so that a hash output for any given input is practically unique to the input; Not totally unique, also because one thing a hash function does is represent a larger set of units with a smaller set of units, making it impossible to avoid a collision at some point - even if it is very unlikely that that point will occur; or it is only likely to occur after a long period of time.
1 Like