Homework on Hash Functions - Questions

1 A hash function is any function that can be used to map data of arbitrary size to fixed-size values.
The values returned by a hash function are called hash values,
hash codes, digests, or simply hashes.
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.

3Collision 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;
that is, two inputs a and b such that H(a) = H(b), and a ≠ b

1 Like
  1. Describe hash functions with your own words
    a) Hash functions are ecentially a unique code (the output) that represents an input. An input produces an output (a function) but once that input has changed, the output has also changed.

  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).
    a) In bitcoin, the hashing algorithm is used to write new transactions within the blockchain. Also you use the hashing function for creating passwords etc.

  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) Meaning that its not feasible to find 2 inputs that produce the same output.

1 Like
  1. The hash function is represented by an algorithm that can create an unique output pattern / “fingerprint” of the input data. The input can be of any length but the output will always be of limited data bits.

  2. I haven’t understood it completely. However, this is what I have managed to find:

  • A block contains multiple transactions
  • The transaction are run through the hash function obtaining hash values before creating the block
  • The newly created outputs are also being run through hash functions this resulting in a Merkle Tree
  • The final hash value will be the identity of the Block that is going to be added to the Blockchain…I think.
  • In order for the Block to be validated by miners, the miners must “guess” the identity of the Block Hash Value…I think.

Looking forward for next videos and hopefully I will understand better from the course. :confused:

  1. The collision is represented by the possibility of a Hash Function to generate similar Hash Values while having different input data.
    In this scenario the Hash Function needs to be Collision Resistant in order to NOT create similar Hash Values.
1 Like

Homework on Hash Functions - Questions

  1. Describe hash functions with your own words
    It’s a formula that transforms an input into a unique code (output). The purpose is that the formula makes it impossible to go from output to input, because the formula is unknown.

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

Transaction data, such as amount, walletadress and hour and day are transformed into transaction ID (unique digital finger print of your transaction), in order to verify and confirm that a transaction has happened.

Every block in the blockchain contains transitions that together generate a new hash, and that new hash will be added to the next block in the blockchain.
This means that every hash refers back to all the transactions in the block that preceded, generating an independent unbreakable chain. (very important for the immutability)

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

There is a very low probability that a different inputs generate the same output.

1 Like
  1. Hash functions are based on cryptography. They enable one to “convert” an input value such as a text, a document or a private key (which is even longer than a SHA-256 based hashed value) into an unique encrypted output. There are many types of hash function. Some are more efficient than others. The ultimate goal of hash functions is to insure information security when sent to another party.

2.Every transaction contains pieces of information such as :

  • the amount
  • the sending and receiving address
  • timestamp
    etc…

All these information are combined into the formula to produce a hash called Transaction ID. It is a hash value used to verify and confirm that a transaction has happened. The first block in a blockchain is the genesis block which contains transactions that when combined, produce a unique hash. When the second block is created, the hash of the genesis block is added to all of the new transactions in the ne block. This combination is used to create its respective hash. This process is repeated with all the new blocks being added to a blockchain always taking the previous hashes to create a newer one creating an unbreakable dependency. This way each block links back to its previous block through its hash forming a chain back to the genesis block which makes blockchain a secure, immutable and transparent network.

  1. It means that hash functions need to make sure two different inputs don’t lead to the same output.
1 Like
  1. A hash function is a mathematical function that produce a value from a selected string of text. No matter the length of the input text, the output result will always have the same number of digits. This is a one way function. You cannot find the initial string of text from the hash generated.

  2. Hash functions are used in cryptocurrencies to ensure the authenticity of the transactions and to validate the identity of the users.

  3. A hash collision appends when 2 different inputs generate the same output. A hash function that need to be collision resistant means that the hash function used has to be strong enough to avoid the collision (such as SHA-256 used in Bitcoin). In practice this situation is considered rare, even impossible.

List item

1 Like
  1. Hash function ( Relating to SHA-256) is a function that provides an an Unique ID to each and every input without the possibility to calculate back and find the Input from the output. [ I think I over complicated things here.]

  2. The hash functions are part of the block hashing algorithm which is used to write new transactions into the blockchain through the mining process.
    In bitcoin mining, the inputs for the function are all of the most recent, not-yet-confirmed transactions along with some additional inputs relating to the timestamp and a reference to the previous block.
    That easily produces output in one direction for a given input but is impossible to find the input even if the output is known. So going back isn’t possible.

  3. 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
  1. Hash functions are functions that have a unique input that will produce a unique output, and can’t be done the other way around (output to input).

  2. In a cryptocurrency like Bitcoin, transactions are taken as an input and then run through a hashing algorithm that will give a unique output of a fixed length. For this we need proof of work, and that is where mining comes in.

  3. Hash Functions need to be collision resistant in the sense that it can’t be easy for two or more inputs to get the same output, it can be done, but it is really hard to do and statistically not relevant, this way it is almost impossible to reverse a function (output to input) with brute-force.

1 Like
  1. Describe hash functions with your own words.
    Hash functions are complex mathematical algorithms that uses a unique input to produce a unique output string that has a consistent digit count.

  2. How are hash functions used in cryptocurrencies like bitcoin?
    To encrypt/secure the data on the network and prevent hacking/altering the network in ways other than designed.

  3. What does it mean when we say that hash functions need to be collision resistant?
    Collision Resistant means it is very unlikely to produce two of the same hash functions from two different inputs, which would result in an orphaned (unusable) block.

1 Like
  1. A hash function is a function that gives a unique output for a unique input. It means that the same input will always give the same output. It also means that it’s not theoretically possible to find the input knowing the output.

  2. They are used to create private key : the passphrase is hashed and it provide the private key, proving that the user is in control of his wallet.

  3. Being collision resistant means that there is no, or it’s very difficult to find to different input that give the same output. Obvisously, if SHA256 wasn’t collision resistant, it would be possible to access the same wallet/private key with two different pass phrase, and that would be dangerous.

1 Like

1 - Hash functions create what is called a digital fingerprint, a HEX code of an input while fulfilling six requirements of cryptography. They need to be deterministic (same input = same output), their computation must be quick to ensure network efficiency, they must be pre-image resistant, i.e. it must be infeasible to determine the input from only having the output, they must be immutable, which means that small changes in the input should cause some or ideally big differences in the output, they should be collision resistant, which means that if we have two different inputs, we also should always have two different outputs, and they should be puzzle friendly, which means that when we concatenate the input with a factor from a min-entropy distribution that we will never receive the same hash.

2 - To secure the integrity of the data within the blocks and for mining.

3 - Collision resistant means that if we have different inputs, we also should always have different outputs.

2 Likes
  1. Describe hash functions with your own words

Hash functions are cryptographic algorithms. They are used to secure data. A non-hash function is not secure because you can determine it’s input if you know it’s output. They have several properties that make this possible. 1. They are deterministic - meaning that for a particular input you always get a particular output. 2. They have quick computation. It seems like this property doesn’t necessarily make it secure but it does make it usable. And if it weren’t usable it wouldn’t provide any security in the first place. 3. They are pre-image resistant - meaning that it is extremely difficult to determine the input if you only know the output. 4. Any change to the input produces a very unique output. This makes it impossible to determine the input by comparing different hashes. 5. Collision resistant - meaning it is extremely unlikely that you will get the same hash from two different inputs. It’s not impossible but basically so improbable that it won’t ever happen. 6. They are puzzle friendly - meaning For every output “Y”, if k is chosen from a distribution with high min-entropy it is infeasible to find an input x such that H(k|x) = Y

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

Hash functions are used in bitcoin to make its blockchain both secure and immutable. Each block in the bitcoin blockchain contains a hash of all the data in that block. It uses the hash of it’s hash in a merkle tree structure as a pointer to it’s previous block in the chain. So, if any data in one block is ever changed at all it would result in a change to all previous blocks. This is due to property # 4. Any change to the input produces a very unique output.

  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 means that you are extremely unlikely to every get the same has from two different inputs. If a hashing algorithm weren’t collision resistant it wouldn’t be useful because the hashes would not be unique. Therefore no hash would ever serve as an identifier of it’s input.

1 Like
  1. Hash functions produce a unique and replicable output for each input, like a fingerprint. In that way they can serve as data integrity checks. The function should not work in reverse, that is, given an output one should not be able to deduce the input.

  2. Hash functions are used in order to link together past blocks with current block into the chain, since hash of previous block header appears in the next block. It also serves to validate each tx, since hacker’s attempted inclusion of a false tx not truly included by the miner would produce the wrong hash.

  3. It means the search space for 256-bits is enormous, so trying to find a collision, i.e., new input that produces the same hash would take a very long time using all the computers on Earth, not feasible. This is needed or else you lose the “fingerprint” property of hash functions.

1 Like
  1. Hash function is an amount of data transfered in a fingerprint with always the same length. Its easy to go from the fingerprint to the source of data but not back.
  2. Transactions are taken as input and run true a hashing algorithm SHA 256 which gives you an output of fixed length.
  3. Collision resistance means is it hard to find two inputs that hash to the same output.
1 Like

1)Hash functions take whatever information You input and turn them into random string of numbers. And if You change anything in your input, add a letter number or space the hash will be absolutely different. Hash is any inputs digital fingerprint. Unique.

  1. Hash functions are used for mining BItcoins. The whole block of previous transactions is hashed and the new transaction is hashed, put togeather and than miners try to guess what this transaction was via hashing/decyphering/guessing game.

  2. It means that no to different inputs should end up with the same hash.

1 Like

Answers:
1.You start with input(hash) and through program of cryptography you get output(hash) that’s different from input, it’s on finger print. Data in one point data out another point. It is also a fixed size of data. I beleive its similar as an email account when you start one, then you log in later, one in one out.
2. The hash algorithms used by SHA-256 input and outputs are what keep Bitcoins blockchain to be decentralized and secure. The way it is accomplished is through cryptographic hash functions using electricity.
3.Hash functions need to be “collision resistant” , if 2 different inputs have same output you have a problem and that would be a collision. I believe POW and mining is what solves this through its hash(algorithm) function.

  1. Hash functions gives for each unique input a unique output. This process is not to reverse and you receive a unique fingerprint or code for this data that you have put in.
  2. A hash of the block is created using cryptographic technologies and it is added to the next block as a representative of the information in the previous block.
  3. Collision-resistance means two distinct inputs must not produce the same output.
1 Like
  1. Hash functions are one way mathematical formulas used to encrypt any size data into unique bits of information of a fixed size called the digest.

  2. In Bitcoin the hash used is called the BLOCK HASHING ALGORITHM. Using the mining process this algorithm writes new transactions into the block chain. The inputs include, all of the most recent not-yet-confirmed transactions, inputs relating to the time stamp and a reference to the previous block.

  3. When we say collision resistant we are referring to the desire that once we use a hash function for a set of data then that result will never equal any other result. The output of hashed data has the same amount of bits regardless the size of the input. Using the pigeonhole principle then we must conclude that when the data to be hashed is larger than the data that is the result of that hash then some inputs when hashed will generate the same output and therefore theoretically we will always have collisions. However the amount of possible permutations are so high that the amount of time and computational power required make it extremely unlikely that the collisions will ever be found. At least not until the advent of the quantum computer.

1 Like

1- They are special functions that produce unique fingerprints from their inputs, and there is no way to figure out the inputs just by knowing the outputs.

2- they are used to encrypt and link the data in the blockchains.

3- It means that the possibility of two inputs resulting in the same hash output (fingerprint) is infeasible, so remote that it does not affect the robustness of the corresponding hash function.

1 Like

a collision happens when 2 different inputs of information produces the same hash (fingerprint) wich is not good. Sha256 is very good in being collision resistant.
2 miners can find a block at the same time, but this would have a different hash, except if they used exactly the same transactions in the same order. Ect…