Homework on Hash Functions - Questions

Package managers in Linux usually connect to different mirrors where they download packages and they also check signatures of the downloaded package to verify its legit in the same way in case of a malicious mirror or just a corrupt download :slight_smile:

@Alko89 if you think your nagging me keep nagging! To be completely honest I love it. You are challenging me abs challenge is good. Thank you for it. Just be patience with my response because I’m traveling thru these lessons working to get an understanding.

  1. Hash functions is essentially a set random genarator that converts anything into a string of code. They must always produce the same result for the same input.

  2. Hash functions are used to keep track of mining blocks in bitcoin. They provide an open ledger of data that that is transferred on the chain within blocks.

  3. Collision resistant means that no two inputs will ever create the same output.

1 Like
  1. Hash functions take an input, concatenate a variable with it and produce an output. In order for it to be successful the output must be the same each time the same input is used.

  2. Hash functions are used in the blockchain to store the data and timestamps from previous blocks to help prevent corruption. They are also used in mining.

  3. Collision resistant means that two hash functions will not have the same output unless they are the same input. Because of the amount of inputs and limit on outputs, there can be collisions, but the odds are minimal making it collision resistant.

1 Like

Ok…so why are hash functions useful? :smile:

  1. Describe hash functions with your own words
    Hash functions create fixed length deterministic representation of a data structure.

  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 are tools used to quickly validate the integrity of any data structure like transactions and blocks.

  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).
    A collision resistant hash means that we must not find two inputs that create the same hash output.

2 Likes

Yeah I did say it lol. It creates a unique and uniform size for data.

  1. Describe hash functions with your own words
    A function who’s input is creates a unique output and who’s input cannot be solved by knowing it’s output

  2. How are hash functions used in cryptocurrencies like bitcoin?
    Hash functions are used to encrypt transactions, create addresses, and private and public keys on the blockchain

  3. What does it mean when we say that hash functions need to be collision resistant?
    It means that each input will need to have it’s own unique hash

Awe I see… So that is why they say to install programs from the package managers if available.

Yes, but again this is a property of hash functions. The question is why is this useful for blockchains? :smiley:

Hash functions are not used for that. The public key is derived from private using another function called the elliptic curve, but the public key is indeed hashed to to get the address. Also transactions are hashed, but not for encryption, its how we get the txid. There is another important use case for hash functions. Can you figure it out? :slight_smile:

That and it also saves a lot of time managing applications since package managers also manage updates apply configs and other stuff specific to the application you are trying to install. Most people that came from M$ are not used to the convenience of package managers since they are used to install everything by hand :stuck_out_tongue: It saves so much time for you, so you should definitely learn to use them :smiley:

1 Like
  1. Hash functions allow for unique one way outputs

  2. Hash functions are used in cryptocurrencies to secure data

  3. collision resistance means that its hard for two inputs to hash the same output. hashes with more
    inputs than outputs will have collisions.

1 Like
  1. A hash function takes an input. Then assigns it a set of numbers and letters to it, creating a unique digital signature.

  2. Blocks contain hashes. String them together to create a block chain.

  3. Two different inputs will not produce the same output.

1 Like

1.For each unique input will produce a unique output, the output becomes a unique digital fingerprint of that input.

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.

  1. Collision resistant means it is hard to find two inputs that hash to the same output.
1 Like

Why is it useful @Alko89?

  1. A one way function that produces an output of usually fixed length. There should be no way of determining input when given an output. It should be infeasible to find a different input that produces a given output. Slight changes to an input result in a completely different output.

  2. they are used within blocks to ensure that the previous block has not been tampered with. Also used in user validation (mapping private key to public key. Another use case is when generating btc addresses from a seed phrase or private key.

  3. It should be infeasable to find two inputs that produce the same output.

2 Likes

Describe hash functions with your own words

Hash functions are unique inputs that create an unique output. Any changes to the original input, will create a different unique output.

How are hash functions used in cryptocurrencies like bitcoin?

Hash functions are part of the blockchain algorithm and is used to write new transactions in the blockchain through the mining process.

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

Collision resistant is that it is very unlikely for two inputs to hash out to the same output. If hash functions are not collision resistant. It allows attackers to cheat the system.

2 Likes

A hash function is a mathematical function used to generate a value from a string of text where we provide a input to get an output.

Hash function such as SHA-256 is used in Bitcoin to write new transaction into the blockchain through mining process.

In Bitcoin Hash function, each input has a unique output. Hash functions are collision resistant because it is hard to find two input with the same output using SHA-256.

2 Likes
  1. Describe hash functions with your own words

Hash functions are mathematical equations that turn data (text or numbers) into a unique string of letters and numbers. Hash functions take an input and give a unique output. In a regular function, you can easily figure out what the input is when you look at a series of outputs. In a hash function you cannot determine what the input was by looking at the 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).

All the transactions with bitcoin are received by the network as inputs, then the miners run the inputs through the hashing algorithm in order to add them to the blockchain.

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

The hash function needs to be collision resistant so that the outputs are unique to each input. If it was the case that one output was the same for two different inputs, then there would be collision and inputs would no longer consistently give unique outputs that are a ā€œdigital fingerprintā€ of each input.

1 Like