Homework on Hash Functions - Questions

1. Describe hash functions with your own words

*functions have an input and output, it is a function that turns a random input of data (keys) into a string of bytes with a fixed length and structure (hash value) = 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).

1 a hash function turns any input into a predefined fixed output format
2 btc is a blockchain and you can find hash functions in every block. they give every block specific information. any change to a block will change all other blocks. so its good for security.
Hash functions are also used in mining (do not understand this completly yet)
3 theoretically it is possible that a different input gives the same output. you can score the ā€œcollision resistanceā€ by the chance that this can happen. It must be very low

1 Like
  1. Describe hash functions with your own words.
    Hash functions turn a random input of data (keys) into a string of bytes with a fixed length and structure (hash value) = 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).

  • Basically, the Bitcoin network depends on a set of rules termed [Proof of Work] consensus algorithm. The consensus algorithm is a set of rules that rules the blockchain network. Outside of cryptocurrencies, the most common usage of hash functions is in the storage of passwords. The overall for BTC needs to be a high hash rate because it makes the network more secure. If someone wanted to attack the BTC network, the X person needs at least 51% of all the hash rates and the world, good luck with that.

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

Given your example of 1 billion users at 10 addresses each:

There are 2^160 or about 1,460,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000 possible addresses
In your scenario, 1,000,000,000 people are using 10 addresses each for a total of 10,000,000,000 possible addresses
10,000,000,000 / 2^160 should yield the probability of a collision occurring
10,000,000,000 / 2^160 = 0.00000000000000000000000000000000000000684

So the chances of a collision occurring in your scenario are approximately 0.000000000000000000000000000000000000684%

See why we don’t consider collisions an issue?

2 Likes

1.) Describe hash functions with your own words
Hash functions are computation of data of any length by a software program, the results are unique to that specific data, any change within that string, another unique set of characters is computed.

2.) How are hash functions used in cryptocurrencies like bitcoin?
Hash functions are used to record transaction on the Bitcoin network using SHA256, as the name suggest, it produces a 256 character code which is then placed in a block. Other blocks are formed in the same method. These blocks are then inextricably linked forming the chain.

3.) What does it mean when we say that hash functions need to be collision resistant?
The hash functions need to be collision resistant so the production of a hash will be unique avoiding two different inputs that result in the same hash output.

1 Like
  1. Describe hash functions with your own words
    Hash functions produces fingerprint of input data with same length regardless of input. Hashing is fast computation in one direction(input to output(hash))

  2. How are hash functions used in cryptocurrencies like bitcoin?
    In creation of public keys. Miners use SHA-256 and change the nonce incrementally to hit difficulty target(mine the block).

  3. What does it mean when we say that hash functions need to be collision resistant?
    It means that two different inputs creating identical output(hash) needs to be very unlikely.

1 Like

Public keys are not created using SHA256, for that the elliptic curve function is used. :slight_smile:

1 Like
  1. The hash function is a one-way encryption function.
  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. The hash function is collision-resistant if it is hard to find two inputs that hash to the same output.
1 Like

**

  1. Describe hash functions with your own words
    ITs a unique address that contains specific data

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

A cryptographic hash function is a special class of hash functions which has various properties making it ideal for cryptography. There are certain properties that a cryptographic hash function needs to have in order to be considered secure.

  1. What does it mean when we say that hash functions need to be collision resistant?
    In cryptography, 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
1 Like
  • Describe hash functions with your own words

A one way function that creates a unique string of numbers (consisting of letters and numbers and letters) as an output based on a very specific input, where one simple change to the input will dramatically change the 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).

public and private keys

  • 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 can produce the same output every time the same input is submitted but need to produce different outputs for every change in the input.

  1. Hash functions give unique digital fingerprint as output and it is impossible to find out what the input of that output was. They are one way functions.
  2. Still new to all of this, but from my understanding hash functions allow us to store all the data that we want to save and keep track of. No mater how big it is. And for that unique input of data, hash function always produces the same hash, same output. Each block has a hash of its own data plus the hash of the data of the previous block. Together they have a new hash that gets inside the next block. That way a chain is formed and in that chain nothing can be changed otherwise it automatically changes everything else. So if unique data gets its unique hash it means a cryptocurrency like Bitcoin can not be copied and someone can not claim they have x amount of Bitcoin unless you can see a proof of that in the blockchain. All of that thanks to hash and hash function. (Hopefully someone will confirm I am on the right track here) :slight_smile:
  3. It means that the chances of two hash being same but with different input should be very low. I think that is why Bitcoin block is mined every 10 minutes.

The output of a hash function is not really an addres. Hash functions take some input and perform some mathematical operations to produce an output. Everytime you hash the input, it will always produce the same output and it is not possible to calculate the input from the output. The only way to discover the input is by brute forcing it. (keep guessing the input and check if you come to the same hash)
Another important characteristic of hash functions is that if you change only 1 character, the output will be completely different

2 Likes

Keep in mind that public keys are not created by a Sha256 hash function. Public keys are calculated using eliptic curve cryptography.

1 Like

Thanks for clarifying that for me. I was answering it as a consideration that it is a derivative in the sense that without the private key a public key cannot be produces and without the hash function the private key can not be produced so, without the hash functions a public key can not be produced as an end result, i could have been less confusing in my answer and left it out but i did not know the mathematical formula used to create the public key through a private key was elliptic curve cryptography, thanks for pointing it out and giving me more to learn. :slight_smile:

1 Like

1- Hash function takes a list of data and converts it to SHA 256. Input text into a unique output, This process provides a unique list base 16 identifier of your data a digital fingerprint.
2- Deriving public keys to block signatures verifying transactions, transaction data is stored on blocks each block has a unique hash SHA 256 a, any slight change will result in the hash on block to change.
3- Having two different inputs providing the same output is referred to as a collision. Collision resistance means that it is unlikely to get the same output from a hash function but not mathematically impossible

1 Like
  • its like a fingerprint (output) for a specific total of data (input).

-used for:

  • block mining
  • transaction mining / validating
  • it is mathematically infeasible (yet not important)for to inputs to produce the identical output.
1 Like

Public keys are not derived using SHA256 but the elliptic curve function. :slight_smile:

1 Like
  1. Hash functions are functions which produce a unique output for each input. Also, the output of hash functions cannot be traced back to the original input. With hash functions, you cannot find the input using the output.
  2. Hash functions are used to complete and verify transactions.
  3. Hash functions need to be collision resistant because if they are collision resistant then it is difficult to find two inputs which create the same output. We need this property because hash functions must create a unique output for each input.
1 Like

1 - Each unique input gives a unique output.

2 - Are used to cryptographically secure transaction data. It allows the blockchain to be open, transparent and secure. Each block on the blockchain is turned into a hash that is stored as the leader in the next block.

3 - No collision means it is impossible to find two different inputs that produce the same output, doesn“t mean that collisions are impossible, but that the probability of a collision is almost zero.

1 Like
  1. The hash function is a function that creates a fixed-length output value that is unique to each input. These functions are deterministic (Idempotent, basically), fast, the input cannot be guessed from the output and they are collision resistant.

  2. In Bitcoin, the hash functions are used for a couple reasons. First, to allow easy verification of data. Second, to provide tamper-proof data structures, like Merkle trees. Al finally, to keep integral pointers to the previous block, combining the pointer with the data in it. Hashes also save space given their fixed-length nature.

  3. Hash functions need to be collision resistant so that finding two inputs that produce the same output is very difficult or near impossible. This property provides security to the function and adds to the pre-image resistance feature.

1 Like
  1. Hash function takes an input string of any length and returns an output of a fixed length using a mathematical function.

  2. In cryptocurrencies hash functions are used to write new transactions onto the blockchain through mining.

  3. For a hash function to be collision-resistant means that it has to be impossible for 2 different inputs to give the same output.

1 Like