Homework on Hash Functions - Questions

  • Describe hash functions with your own words
    Hash function is a one way function to transform inputs into an output in which it is hard or impossible to figure out the inputs from an output and the chance that different inputs have the same outputs is almost 0.
  • 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 used to convert private key to public key and then 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):

The chance to have the same outputs from different inputs is nearly 0.

1 Like

A hash function takes an input and converts it to a unique output. The same input always creates the same output. The function can not be solved in reverse. Similar to adding whole products in a blender. Once blended, you cannot get the ingredients back to their original form.

The hash function is used in the mining process to create the mined blocks in a unique way. Hashing is also used when working with private and public crypto addresses.

Collision resistant means the prevention of getting the same output from 2 different inputs into the hash function

1 Like
  1. 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 in a unidirectional manner --> once the output is produced, there is no way to revert to the raw data as there are 2^256 possibilities
  2. In Bitcoin, miners are verifying transactions through proof of work. Proof of work is a special number which together with the information for the transaction gets sha 256 applied to it -->if the output (hash) is meeting a specific threshold (f.e first 30 bits are 0), it gets verified and added to the block. Miners are “listening” for transactions being broadcasted, collect the information on a block and do many attempts to “guess” the special number which produces the output below the specific target. Once they accomplish that, they announce the block they found and get rewarded for the work.
  3. In cryptography, 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
1 Like
  1. Hash functions are used to encrypt the network and also act as a one-way mechanism that prevents the inputs from being solved from the output data. Not my own words, but also has been referred to as “creating a digital fingerprint”.
  2. For bitcoin, the inputs for the hash function are all the most recent “unconfirmed” transactions along with other on-chain information. then miners work together to “Solve” a block and successfully verify those new transactions.
  3. Put simply, this means it is very difficult to find two different inputs that will result in the same output. Every output should be unique for the hash function to be truly “collision-resistant”.
1 Like
  1. Describe hash functions in your own words. Hash functions are any size data that when processed through mathematical computation, hash algorithm, creates a unique fixed size output or digest. Any change in the input however so slight will result in a different output. It is a one-way calculation and can never be reversed to get the original data making it secure.

  2. How are hash functions used in cyrptocurrencies 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. For cyrptocurrencies like Bitcoin, hash functions are transactions that take inputs and run them through a hashing algorithm (SHA 256 for bitcoin) giving it an output of fixed length. Crypto hashing algorithms are used to mine for bitcoin.

  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). Because crypto hash functions have one set of data that will have its unique output, therefore you should never have two different inputs resulting in the same hash algorithm. By checking the hash on data it ensures its integrity and that it has been untampered with. For example, computing the hash of a downloaded file and comparing the result to a previously published hash result can show whether the download has been modified or tampered with.

1 Like
  1. Describe hash functions with your own words
    Hash functions are uni-directional mathematical functions which gives a totally unique output for an input. They cannot go from output to 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 in bitcoin are used as transaction verification which would establish ownership of a wallet

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

Collision resistant Hash functions means that any two different input can have a same output. This would be a disasterous in crypto currency since this would mean that two different private keys would give access to the same wallet or same address.

1 Like

A hash function is a complex algorithm that converts any kind of data into an hexadecimal number.
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).
I think that the functions are used to validate the blocks- basically you compare the result of the hash function to validate the block.
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).
If it is hard to find two inputs that hash the same output.

1 Like

Hash functions are not used to derive public keys. For that the Elliptic curve function is used. But the same principle applies when it comes to collisions. Its just the use case is different. Hash functions are used in PoW and generating txid by hashing them. :slight_smile:

Assignment:

  1. Describe hash functions with your own words
  • A hash function is a function that creates a irreversible unique output based on binary input.
  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).
  • Bitcoin stores the all activity as hashes on the blockchain, from private and public keys, to block verifications and transactions
  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).
  • A collision resistant hash function makes sure no multiple inputs outputs the same hash.
1 Like
  1. Describe hash functions with your own words

For an input you will get and unique output. It is a one way function. Impossible to go from output to input.

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

In Bitcoin the hash function are part of the block hashing algorithm that miner have to solve to confirm transaction.

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

For a hash function to be collision resistant mean that for 2 different input it is almost impossible to hash the same output.

2 Likes
  1. Describe hash functions with your own words
  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).
  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.1. In the Blockchain network, Hash function is the process of converting an INPUT data of any length into an OUTPUT of fix size string data of 256-bit using a mathematical function. This means that any text or binary data no matter how long it is, it can be converted into an alphanumeric string of data through an algorithm. Hashing is a one way process enabling security during data transmission to a particular recipient.

It is important to notice that cryptographic Hash function algorithms can only produce unique Hash value to a given INPUT data; the Hash value cannot be reversed to calculate the INPUT data. Hence they are known to be collision-resistant and irreversible. This ensures data integrity.

The OUTPUT data i.e. Hash value is written in hexadecimal numeral system using 16 distinct symbols 0 to 9 and A to F.

This means:

INPUT (data to be hashed) + Hash function = OUTPUT (Hash value)

Example:

INPUT X—Hello world!; INPUT Y—Helloworld!

Hash function SHA-256

OUTPUT X: c0535e4be2b79ffd93291305436bf889314e4a3faec05ecffcbb7df31ad9e51a

OUTPUT Y: 5c6e9ce66cd85898720fcc906a5ccd2e8447deea99e81ac3c46a6563b29200bf

Please note that the OUTPUT data is known as “Hash value” or just “Hash”.

A.2. In Bitcoin, Hash functions are part of the block Hashing algorithm used to write new transactions into the Blockchain through the mining process.

For instance, the 1st block in the Blockchain also known as Genesis Block contains transactions that when combined produce a unique Hash. When the 2nd block is created the Hash of the Genesis Block is added to all of the new transactions in the new block. This combination is used to create its respective Hash.

This process is repeated with all the new blocks added to the Blockchain by taking previous Hashes to generate newer ones and therefore creating an unbreakable dependency. This means that each block links back to its previous block through its Hash forming a chain back to the Genesis Block. This makes Blockchain a secure, immutable and transparent network.

A.3. Collision-resistant function simply means that given two different INPUTS X and Y where F(X) and F(Y) are their respective Hashes, it is unlikely for F(X) to be equal to F(Y). What that means is that for the most part, each input will have its own unique Hash. For example:

INPUT X—Hello world!; INPUT Y—Helloworld!

OUTPUT X: c0535e4be2b79ffd93291305436bf889314e4a3faec05ecffcbb7df31ad9e51a

OUTPUT Y: 5c6e9ce66cd85898720fcc906a5ccd2e8447deea99e81ac3c46a6563b29200bf

Collision-resistant is one of the characteristics of cryptographic Hash functions.

Other examples of cryptographic Hash function characteristics are:

  1. Deterministic
  2. Quick Computation
  3. Pre-Image Resistance
  4. Small Changes In The Input Changes the Hash.
  5. Collision Resistant
2 Likes

Good info. Nice explanation.

1 Like
  1. A hash function takes any input and gives an output, with the output acting as a digital fingerprint, an encrypted reference specific for the input data.

  2. Bitcoin uses SHA 256 in it’s proof of work network to encrypt the data and to keep it secure from malicious actors. SHA 256 is an algorithm that turns any data into an arbitrary alphanumerical number of a certain size, in this case 256 bits, which equals to 64 letters and numbers.
    When a transaction is verified by a node, it waits in the mempool until the miners pick it up and compete to solve complex algorithms associated with the data input. When one finds the solution, it asks the other miners in the network to verify that it is correct. This is how they show proof of their work with solving the math problem as each miner individually tries to solve it. If the other miners come to the same conclusion, the transaction is added to the block and the solving miner gets the reward.

  3. A hash function is collision resistant when it is hard to find two different inputs that would give the same output.

2 Likes

Describe hash functions with your own words
It is a function/algorithm designed to create digital fingerprints/signatures, where each unique input gives a unique output. Furthermore, it is designed to not be reversible (a one way function). You can never retract the input from the output.

How are hash functions used in cryptocurrencies like bitcoin?
It is used to write new transactions in to the blockchain, also called “proof of work”. This way there is an easy traceable proof of transactions that is nearly impossible to alter, due to the “irreversible” nature of the hash function.

What does it mean when we say that hash functions need to be collision resistant?
That mathematically, generating two colliding hash values need to be very difficult and unlikely to happen.

1 Like

Describe hash functions with your own words :
Hash functions are functions that produce a unique output from each unique input and the function only goes one way, meaning, that you can get output from input, but now vice versa.

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 BTC hash is used by miners, to succesfully mine a block they try to combine all the all most recent not yet confirmed transactions, timestamp, reference to the previous block and arbitrary piece of input in such a way that the resulting hash starts with a certain number of zeroes. This requires a masive computing power.

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

It means that it is difficult to find 2 functions with different input who produce the same output in the hash function. The harder it is to find the function, the safer the hash function.

1 Like
  1. Describe hash functions with your own words
    -> Hash functions are a way to map data from one input to an output of some specified sort. SHA-256 for example takes input and outputs a string in hexdigit format. This output is unique for every input and it also cannot be mapped back to figure out the original input. However, every time the same input is given to the hash function, it produces the same 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).
    -> Hash functions are used in the block hashing part, before new transactions are added to the blockchain. This takes place during 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).
    -> A collision happens when two (or more) inputs fed to the hash function can result in the same output. If this happens, then the output from the hash function won’t be unique for each unique transaction and therefore cannot be used as part of the mining process to verify transactions; as theoretically, the transactions can be different, but have the same hash output.

1 Like

1. Describe hash functions with your own words
Hash functions create a unique output for the input information. With hash functions like SHA-256 the output can not be reversed to the input.

2. How are hash functions used in cryptocurrencies like bitcoin?
Hash functions are used for the mining process in bitcoin. The miners are calcuation the hash and create after solving the puzzle a new block. Each block has the information of the current hash and the previous hash stored.

3. What does it mean when we say that hash functions need to be collision resistant?
Collision resistance means when it is hard to find two inputs that hash to the same output.

1 Like
  1. Describe hash functions with your own words
    Answer: Is a one way function that gives unique output for each input we put. A single change of a bit changes 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).
    Answer: bitcoin uses hash function that is called SHA256, so basically, any input in bitcoin is turned into SHA256 function.

  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).
    Answer: Hash function needs to be collision resistant, otherwise it would allow a person to substitute a “signature” of lesser value while still producing the same output, which the receiver of that value would have no way of knowing.

1 Like
  1. Hash functions are irreversible functions (cannot go from output to input - in theory) that map some input data to a fixed-size values of output.

  2. The hashing function is used by the miners to add their mined blocks to blockchain. They need to hash the block header in away that the output will be less or equal to the target hash, which is the condition to successfully add block to blockchain.

  3. If a hash function is not collision resistant then it is broken as it should never produce the same output from different inputs, if that happens, then collision takes place. However, even though it is important to have a collision resistant hash function, there are no collision free hash functions as their output size is fixed.

1 Like

1.) Hash functions are a way of encrypting data, into a long(mostly hexadecimal) string, which is unique for every unique input and cannot be reversed.

2.) Hashing in Bitcoin is also used to encrypt data. Miners have to include all new transactions (and if I understand correctly, the hash of all previous transactions as well,) into a hashcode in a way that the resulting hash starts with a certain number of zeros, which they can achieve by adding a nonce to their string.

3.) We need a hash function, where the possible number of inputs is lower than the possible number of outputs, so we won’t find two different strings of data that have the same hashed version. Alternatively, we have to have a hash function where it is at least really hard to find two (or more) inputs with the same encrypted form.

1 Like