Homework on Hash Functions - Questions

Homework on Hash Functions - Questions

  1. Describe hash functions with your own words
    Hashing is the process of converting an input or text of any length into a fixed-size string of text (no matter the length of the input), using a mathematical function. The output is called the ‘Digest’ or ‘Hash’.

  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).
    Bitcoin uses the hash function SHA-256. This particular secure hashing algorithm is one of the most popular because unlike some previous hashing algorithms, reverse engineering to display the input from the output is virtually impossible and highly improbable as it would take 100’s of years of brute-force attack making rendering the process useless.

The hash provided by these algorithms provides the security to the blockchain ensuring that all blocks appended into the chain are immutable.

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

This means minimizing the likelihood that two unique inputs generating the same hash (output). In other words, with strong collision resistance, each input will have its own unique hash.

2 Likes

1.) Describe hash functions with your own words?: They are one way functions where each input produces a unique output that acts like a digital finger print.
2.) How are hash functions used in cryptocurrencies like bitcoin?: They convert an input made up of letters and numbers into an encrypted output of a fixed length.
3.) What does it mean when we say that hash functions need to be collision resistant?: a hash function is collision resistant when it is extremely difficult to have two inputs that produce the same output.

2 Likes
  1. Describe hash functions with your own words
    The hash functions create a digital fingerprint of the input data, thus transforming the input and securing its content in a way that is not possible to decode.
  2. How are hash functions used in cryptocurrencies like bitcoin?
    Hash functions are used in mining a new block, trying to find a new block that paired and hashed together with a random string will match the difficulty that was set. Hash functions are also used to secure the blockchain or rather its integrity by hashing the new block’s data together with the previous blocks pointer so that data within the public ledger gets accepted when consensus is reached that this data is correct by comparing the output of the hash function from multiple nodes. Consensus can be reached quickly since it is quick to determine the hash for a given input and compare the hashes so that to confirm that the content is the same.
  3. What does it mean when we say that hash functions need to be collision resistant?
    It is difficult to find two inputs that hash to the same output.
1 Like

Describe hash functions with your own words
For unique input A, you get unique output B.

How are hash functions used in cryptocurrencies like bitcoin?
Hash functions are used by mining software to add new blocks to the blockchain. Each block has a copy of the hash from the previous block, along with it’s own data, and then that is all hashed together to get a new unique output.

What does it mean when we say that hash functions need to be collision resistant?
This means that for a unique output B, there can be only one unique input A. Collision resistance becomes practical when using a large enough input universe.

1 Like
  1. Describe hash functions with your own words – has function
    Each unique input gives a unique output

  2. How are hash functions used in cryptocurrencies like bitcoin
    To generate verifiably “random” numbers in a way that requires a predictable amount of CPU effort. In the context of mining, generating a SHA-256 hash with a value less than the current target will earn you a reward

  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).
    Means no two inputs are the same

1 Like
  1. hash functions are unique output of same length, made from combination of numbers and letters (digital fingerprint), and it is assigned to each input of any length. The hash functions are pre-image resistant, making it infeasible to use brute force to find out what the original input was, achieving security to make hashed output irreversible.

  2. Secure hash function 256 is used in cryptocurrencies like bitcoin. SHA-256 meaning there are 2^256 unique output that can be assigned to an input.

  3. hash functions need to be collision resistant, meaning two different input cannot have a same output in order for hash functions to work.

1 Like

True, but can you give a practical example how SHA256 is used in Bitcoin? :slight_smile:

Actually it means the probability of two inputs resulting in the same output :slight_smile:

1 Like
  1. Hash functions encrypt a piece of data and give it a unique identifier by taking the data’s binary form and converting that into a 64 digit code.

  2. I believe hash functions are used in cryptocurrencies to give each coin a unique hash when it is first created, Then this hash is used when the coin is involved in a transaction to generate a new hash for that coin.

  3. The chances of two hashes that were generated from different inputs coming out to be exactly the same needs to be very low

1 Like

Coins don’t have hash values, that would kind of make them non fungible and we don’t really want that. The most important use for hash functions in a blockchain is to link the blocks together inn a chain :wink:

1 Like
  1. A bunch of mathematical operations that give a hexadecimal string output of a consistent length and never give the same output for a different input. They are a ‘fingerprint’ of whatever data is the input.
  2. Each block is encrypted and then with the nonce it is hashed to give an output, the beginning of the output must have a certain number of zeros (how many is the ‘difficulty’) and that output is used in the next block also. The chain can then be checked backwards to show each block is related - thus providing the immutability factor of Bitcoin.
  3. Two different inputs should never (or almost never) give the same output. As long as the chance of this happening is so low as to never practically happen.
1 Like

Hash Functions are input only and produce one unique output.

Used to track transactions

Means that must be nearly impossible to find to inputs that produce the same output

1 Like

1. Describe hash functions with your own words

  • It’s a function which you can go from input to output, but not the other way around.

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

  • The transactions are taken as input and run through a hashing algorithm, which gives an output of a fixed lenght. Because of the properties of hash functions, a slight change in data will change the hash drastically.

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

  • Each input has it’s own hash (in most cases). Given two different inputs A & B, where H(A) & H(B) are their respective hashes, it’s infeasible for H(A) to be equal to H(B).
2 Likes
  1. Describe hash functions with your own words. each unique input creates a unique output. input goes to output but function from going from output to input is encrypted.
  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 function is used to ensure blockchain integrity. a small change to the blockchain would result in a significant change to the hashfunction
    .
  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). mathematically improbable to find 2 inputs that produce the same output.
2 Likes

1) Describe hash functions with your own words
A hash function is any function that can take data (an input) of any size and convert it into a fixed-size value (an output). Each unique input converts into a unique output. Thereby, providing the input with a unique digital fingerprint.

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 relation to Bitcoin, hash functions are part of the block hashing algorithm, SHA-256, and important in the mining process. The mining process is as follows:

  * The hash of the contents of the new block is taken
  * A nonce (random string) is appended to the hash
  * The new string is hashed again
  * The final hash is then compared to the difficult level and is determined if it’s actually less than the difficult level or not.
  * If yes, then the block is added to the chain, the public ledger is updated and alerted of the addition.
  * The miners responsible for this are rewarded with bitcoins
  * The entire process is completely random, It’s pure-brute force.
  * The entire process follows Proof of Work protocol
    * Puzzle solving should be difficult
    * Checking the answer should be easy for everyone.

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 two different inputs A and B where H(A) and H(B) are their respective hashes, it is infeasible for H(A) to be equal to H(B). Infeasible is not impossible rather exponentially unlikely.

3 Likes
  1. Hash functions are a way of codifying information to be compactly assimilated on the blockchain in such a way that you can use the input to get the output but you cannot use the output to get the input.
  2. Utilizing hash pointers that incorporate and link together hashing functions on the block in such a way that any change to any individual data point would corrupt the blocks around it.
  3. There needs to be sufficient variety in possible variables to ensure that the time and effort to brute-force break it is infeasible.
4 Likes
  • Describe hash functions with your own words
    A hash function takes a string of any length and outputs a unique string of fixed length.

  • How are hash functions used in cryptocurrencies like bitcoin?
    Each block in a blockchain contains a hash of the previous block, which contains the hash of the previous block, which contains the hash of the previous block, etc, which means if any one block is changed (tampered with) it changes the hash for the next block. This allows the integrity of the block chain to be audited quickly (relatively).

  • What does it mean when we say that hash functions need to be collision resistant?
    Collision resistant means that any two inputs into a hash function are unlikely to produce the same output.

2 Likes
  1. Describe hash functions with your own words
    Hash functions are One-Way functions, which give an unique output of an unique input. There is no way to go from output to input.

  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?
    No Hash function is completely collision free, because you have more inputs than outputs. The collision resistance must be so high/safe, that it would take a quite very long time to get the same hash value. Also collision resistance is not broken yet.

1 Like
  1. The Hash Function is a one way function. It is practical to validate the integrity of a data.

  2. It is used to pass transactions anonymously. In the context of bitcoin, the transactions are taken as input and run through a hashing algorithm which gives an output a fixed lenght.

  3. It means that 2 hash functions cannot have the same output inside a blockchain. If this happened, it would create a duplication of false transactions and the data would be corrupted.

1 Like
  1. A hash function takes an input of any length and gives an output of a fixed length. This function need to be impossible to reverse or it becomes obsolete.

  2. The transactions are taken as input and run through a hashing algorithm which gives an output of a fixed length. Encrypting it so only the recipient can decrypt it.

  3. Collision resistant means. Given two different inputs A and B where H(A) and H(B) are their respective hashes, it is infeasible for H(A) to be equal to H(B.)

1 Like