Homework on Hash Functions - Questions

1 Hash functions take a unique input and give a unique output. Input data can be of any size but output will be always of a fixed lenght. These are very complex functions that you can’t reverse, given the output it is impossible to resume the input.

  1. Hash functions in cryptocurrencies can be used to verify the integrity of the previous block during mining, in a single string you can prove that everything that happened before the current block is verified.

3 An hash functions can be considered collision resistant when it is nearly impossible to have the same output for two different inputs. Given A and B it is infeasible that H(A) equals to H(B).

  1. Hash functions provide a coded output derived from given input

  2. Bitcoin uses the hash function SHA-256 to create a digital fingerprint to each transaction so that no data stored within the block can be altered without moving forward to a new block and creating a new fingerprint

  3. Hash functions being “collision resistant” is defined by making it near impossible for any 2 different inputs to have the same output

  1. What is the hashing algorithm called used in Bitcoin?

    1. SHA256
  2. Why is this hashing algorithm really hard (almost impossible) to brute-force?

    1. Because Crypto hash function property(s) are designed that way :slight_smile: Too many possibilities.
  1. Hash functions get input and produce output based on the input data. It’s impossible to go back from output to input. And if you change the input data even a little, the output becomes completely different.

  2. In bitcoin each block in the blockchain contains the hash of the previous block header. So if something is changed in the earlier block, the hashes of the later blocks would have to be changed, to make the blockchain valid. Hash functions are also used in mining. Hash of the previous block is concatenated with the nonce, and hash is made out of it. If this hash meets the difficulty criterion, the block is accepted. Hashes are also used in the merkle trees, that are used to store the transaction data.

  3. Collision resistance means, that it is hard to find two inputs, that give the same output. According to birthday paradox, if there are N outputs, sqrt(N) attempts are needed to have 50% change to get the same output.

1. Describe hash functions with your own words. A hash function is a mathematical process that converts data of an arbitrary length to data of a fixed length.

2. How are hash functions used in cryptocurrencies like bitcoin? Hash functions are used to write new transactions into the blockchain through the mining process.

3. What does it mean when we say that hash functions need to be collision resistant? It means that that it is highly unlikely, but not mathematically impossible, that two distinct inputs will have the same output.

  1. Describe hash functions with your own words
    A hash function is a mathematical algorithm that receives a string and will convert this to bits and then to a fixed string. The string could long or not but the output will have the same length.

  2. How are hash functions used in cryptocurrencies like bitcoin?
    Blockchain is like a block each transaction has a transaction ID, the last block hash, and the new hash, then when a transaction finishes, the block joins the last hash with the new one creating a new has. If someone tries to update something on the original string will fail because we have records of hashes in preview block and the transaction will be not valid.

  3. What does it mean when we say that hash functions need to be collision resistant?
    This means that different inputs should return different outputs, this hash function has a complex algorithm so it will be hard if different string creates the same outputs and for the blockchain are important because we can lose data if there are same hashes with different inputs.

  1. Hash functions are algorithms that take input variables and output data in a certain way that one cant know what the input was by looking at the output.
  2. Hash functions are used in crypto’s like bitcoin as a way of storing data in a secure way so that no one can change it and to create order to the system and control the speed in which it can occur.
  3. Hash functions are collision resistant means that no two input variables can give the same output.
  1. hash is process where input generates set of output that is very unique to the input.
  2. transactions made with bitcoin would leave ledger of the transaction with details such as time stamp. then it gets hashed and relayed to next block. it creates immutability and transparency
  3. since hashing contains certain algorithm to create the hash, it is possible to have same has is created at some point. however, likelihood of those two hash somehow interfering each other is so infinitely small that it’s considered if hash are same then the initial input is the same.

Homework on Hash Functions - Questions

Describe hash functions with your own words

A hash function is an encryption algorithm wherein an input of arbitrary size is passed to the function, and the output is unique, repeatable and of a predetermined size. For a given input, there is a single unique output. A slight variation in the input renders a drastically different 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).

Hashes are used in the block to solve the mining question along with the nonce.
They are used to calculate the MerkleRoot for the block in process of being mined.
They are used calculate hash of the preceding block for the block in process of being mined.

In Asymmetric cryptography, a hash of the private key is created and used in the initial phases of generating its related public key.
The public key is hashed twice in the process of constructing a public address of a owner/wallet.

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

No two different inputs to a hash function should render the same output. MD5 :slight_smile:

Would love any corrections here if I’m misunderstanding anything! I feel like I’m grasping the concepts but just barely :wink:

1. Describe hash functions with your own words

Hash functions are a way of taking an input, and producing a completely different output, kind of like you are disguising the input. This makes data more secure by making it impossible to guess the input based on the output. However, this also ensure that data is accurate because each output is essentially a unique digital fingerprint of the input.

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 used to disguise transaction data which (I think?) helps provide anonymity for BTC transactions, as well as make hacking the blockchain almost impossible. Hashes are also used to uncover new blocks(?) in the blockchain which is basically what BTC mining is.

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

For a hash function to be collision resistant, that means that the odds of generating the same hash twice based on different inputs is so unlikely that it’s almost impossible, or at least irrelevant.

1-a hash function takes any combination of letters/numbers and gives an encrypted sequence of letters/numbers which is unique to the entered input.
2- In Bitcoin, hash functions are used to generate public addresses from a private key
3- if the hashing function isn’t collision resistant, you could end up with a copy of an already existing input and have access to the output of that input

  1. A one-way function in which each unique input returns a unique output.

  2. They map data of an arbitrary length to data of a fixed length. The way I understand it at this early point of my journey is that they’re used to write new transactions during the mining process and they’re crucial to making the “proof of work” verifiable since a party couldn’t change any part of the function’s input without changing the output.

  3. Each input should have its own unique hash. If 2 different inputs could run through a hashing function and end up with the same output, there would be a collision.

1. Describe hash functions with your own words
Hash function is a mathematical process that takes input data of any size, performs an operation on it, and returns output data of a fixed size
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).
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. 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 should be hard to find two different inputs of any length that result in the same hash.

  1. Hash function - can be used to take a sequence of letters of any length as input (call a string) and return a sequence of letters of a fixed length.

  2. Hash functions - in Bitcoins are using in mining for new transactions on the blockchain.

  3. Collision resistant - means not 2 different inputs cant have the same output.

Homework on Hash Functions - Questions

  1. Describe hash functions with your own words
    Private key creates the public key but not vice versa. Then they are both needed to unlock.
    Public key can also be used to verify the sender.

  2. How are hash functions used in cryptocurrencies like bitcoin?
    Used with the nounce etc to encryptand build the chain and Mercle Tree in order to securly keep the blockchain record of transactions & data.

  3. What does it mean when we say that hash functions need to be collision resistant?
    Not able to duplicate themselves, or get the same result from two different inputs

  1. Hash function is a special function that given unique input produces unique output and there is no way of deducting the input based on the output.
  2. They are used to hash transactions on a block and to validate blocks (mining)
  3. Collision resistant means that it is very difficult to find two inputs that produce the same output.

this 9 min video had so much information in it. Great JOB!

  1. Hash functions operate to produce a unique fingerprint, only that which a specific type of data well produce a unique combination of numbers and letters that are equivalent to words. That data only will always have that fingerprint on the hash if altered the numbering and lettering of that code is changed significantly as it will produce its own unique fingerprint.

  2. Just off my knowledge of BTC already. Hash fucntions are used for miners to compete aand compute difficulty mathematical equations to process the transitions on the btc blockchain. Therefore rewarding the miner for solving this difficult problem and adding that transaction to BTC blockchain.

  3. collision resistance is important to have because it protects the system from producing any 2 or more inputs that can produce the similar output.

  1. Hash function is a function where you i’ts impossible, to calculate input from the output.

  2. Hash functions are used in bitcoin to give “fingerpints” every bolck of data in the blockchain, so we can easily check if the previous block is original or false

  3. It means that hash function has to work in the way that only one input can give one output. It cannot be two the same inputs which will give the same output

Hashing and enryption are not the same thing. A hash function takes a “fingerprint of an input” and gives a unique output.

"Hashing is used to validate the integrity of the content by detecting all modifications and thereafter changes to a hash output. Encryption encodes data for the primary purpose of maintaining data confidentiality and security. It requires a private key to reversible function encrypted text to plain text.

In short, encryption is a two-way function that includes encryption and decryption whilst hashing is a one-way function that changes a plain text to a unique digest that is irreversible."

Hash functions in bitcoin are used to make sure miners put the work behind their block. Miners by the rules should mine a block only every 10 minutes. Hashing does not provide any anonymity.

1 Like

Try to find out how. Hint: Miners hash blocks because…