Homework on Hash Functions - Questions

  1. Hash functions are mathematical functions that generate an unique digital fingerprint of an input data. This digital fingerprint has a fixed length.

  2. They are used to encode all the transaction information in a certain block from the blockchain, as well as the information in the previous blocks by considering the hash of the previous block.

  3. It means that it should be at least really really hard for two different inputs to produce the same output.

1 Like
  1. Hash functions are used to create a unique fingerprint from any input. With SHA-256 it’s not possible to reverse the hashing. So you never can get the input from the output.

  2. They are used to verify data in the blocks. This is done by hashing hashes (for example all of the data of a block which already includes hashed transactions, is hashed and put into the header of the next block), so no one can manipulate any transaction which is already put into the block chain.

  3. It means that none of two inputs can (or should) have the same output. This is crucial because else there were more than 1 correct input (“answer”) to 1 output.

1 Like

You probably made a typo :wink:
You can NOT reverse engineer from output to input. The only way is to brute force it.

1 Like

A collision means that 2 different inputs can produce the same output.
Sha256 has such a big range of possible numbers that it is very unlikely to have a collision.

1 Like
  1. Describe hash functions with your own words
    Hash functions are designed to be a one way function of taking an input and returning a unique encrypted output. Bitcoin uses the SHA256 function.

  2. How are hash functions used in cryptocurrencies like bitcoin?
    Bitcoin uses the SHA256 function and merkel tree to encrypt its data items such as header info, block data info and the nonce. The encrypted header info is contained in subsequent blocks to show how the blocks are linked together in a chain and to improve the security of the system. The block data is encrypted for security and privacy. These hash values when combined with the nonce and compared against the difficulty level will determine if the new block gets mined.

  3. What does it mean when we say that hash functions need to be collision resistant?
    Collision resistance refers to each input having a unique output and never having two outputs the same which would cause a collision. Bitcoin achieves through SHA256 combined with 10 min block times and increasing and decreasing difficulty levels. Whilst it is possible for collisions to happen its very unlikely.

1 Like

Thank you Fabrice for following up, very helpful!

Sarah

1 Like
  1. Describe hash functions with your own words
    Hash functions convert a unique input (can be of any type, character, string, files) into a unique hash output. The function can only convert from input to output, but is infeasible to know what the input is from the hashed 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 cryptocurrencies by:
  • Hashing the previous block information and current transaction
  • Concatenating the random nonce string to adjust difficulties
  • Re-hashing the concatenated data for miners to verify
  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 it is hard to find two inputs that may result in the same hash. For example when we have two distinct inputs a and b, in collision resistant hash functions H(a) != H(b) because otherwise it indicates a == b.
1 Like

1: A hash function takes an input which could be numbers and or words and converts it to an
output value.

2: Cryptocurrencies like bitcoin use a hash that converts any input text and or numbers and
converts them to an output string of numbers and text 256 bits in size.

3: The term collision resistant in relation to hash functions means that it should be
improbable to have the same input and output.

1 Like
  1. Describe hash functions with your own words
    A: A hash function operates where you enter an input (like a sentence) and you get an output which is a unique combination/string of letters and numbers. You will always get the same output for a particular input. If you change the input even slightly, you will get a different output. However, you will never be able to know what the input was just by looking at the output.

  2. How are hash functions used in cryptocurrencies like bitcoin?
    A: Hash functions are used to write new transactions onto the Bitcoin blockchain. This creates fixed-length output data. This is helpful when the original data is too cumbersome to use in its entirely (it increases computational efficiency). It also increases security as it is hard to derive anything useful about the input from the output hash.

  3. What does it mean when we say that hash functions need to be collision resistant?
    A: It should be hard to find distinct inputs that would result in the same hash after the application of the hash function.

1 Like

That is the property of hash functions, but why is that useful on the blockchain? :slight_smile:

1 Like
  1. Hash functions : each unique input gives a unique output, a unique fingerprint for that input. It’s a one way function where you can go from input to output, but never the other way round.

  2. Transactions are taken as input and run through a hashing algorithm, which gives an output of a fixed length… hash functions are commonly used data structures in computing systems for tasks such as checking the integrity of messages and authenticating information. Cryptographic hash functions add security features to typical hash functions, making it more difficult to detect the contents of a message or info about recipients and senders . Cryptographic hash functions exhibit the following properties:

    • deterministic : always the same result for a certain input
      -quick computation
      -the smallest change in the input changes the output hash
      -collission resistant
      -puzzle friendly
  3. If its hard to find two find two inputs that hash the same output… each input will have its own unique hash

1 Like

lol yes, “now” was meant to be “not”. Thank you

1 Like
  1. Hash functions are mathematical functions that take an input of any length to output a complex alphanumeric output of a defined length.
  2. Hash functions are used to turn transactions into an alphanumeric fingerprint that can’t be decoded into its original form. They’re used to chain one block to the next in blockchains and also to encrypt the data held in each block.
  3. A hash function being collision resistant means two different inputs shouldn’t produce the same hash. This is highly unlikely, but in the slim chance two outputs are equal given different inputs, they’re considered a collision. Inputs are unique, so the outputs need to be unique in order for blockchain technology to maintain its value, so being collision resistant is extremely important.
1 Like
  1. hash function: unique welcoming computed phrase per recipient to ensure its message security

  2. Hash functions are used in cryptocurrencies like Bitcoin in a mining community, playing to computing-solve and get deservedly rewarded in Bitcoin for good, right, quick, unique and immutable new block added to the chain.

  3. Collision resistant: like order and counter-order would produce disorder, 2 different inputs get 2 different hashes

1 Like
  1. Describe hash functions with your own words
    Ans: Hash functions are functions with unique output that cannot be reversed, i.e from the output you cannot find 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).
    Ans: A block stores the address of a previous block in the blockchain in a hashed version.

  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).
    Ans: It would be extremely hard to find two inputs that generate the same output.

1 Like

Outputs of a hash function need to be unique. If the output isn’t unique then it becomes unclear how to process it as it will refer to 2 or more distinct inputs. Although not impossible it is rare that the same hash will be produced by a function making them collision resistant

1 Like
  1. Hashing is a function that takes an input of almost any size and spits out an output of a fixed length according to a set of mathematical rules, resulting in a line of number and letters that is unique to the input text/ string.
    2.The block hashing algorithm for bitcoin coin writes new transactions onto the block chain by finding the correct inputs. Hash functions mean that it is unfeasible to find the original input and so provide integrity/security to the data on the bitcoin network.
  2. Collision resistant functions take an extremely long time for you to find two different inputs to result in the same output.
1 Like

Thanks for the insightful prompt. SHA256 is useful on the blockchain because a complex piece of input data can be indexed to a sting of text 256 bits in size making it easier to located.

It is also good for privacy because the output would only make sense to the sender and anyone knowing the hashing algorithm.

  1. Hash functions act on an input taking its binary code, applying a mathematical formula, which is the hash function and creating a new binary code and translating that into a hexadecimal representation which is the output. The hash function creates a unique code representing the precise source input. The hash result is permanently repeatable to reference the input providing the input has not changed “one bit”, pun intended… Lol. The most trusted Hash formula used for Bitcoin in particular is SHA-256 and is named for its 256 bit length. It is, unlike other formulae used in the past, reliable and you generally cannot derive the input by using the output (not feasible with commonly known tech).
  2. Hash functions are used in Bitcoin as a means of securing transaction information within blocks and the links used to append the blocks together whereas the hash of the previous block is referenced in the hashes of succeeding blocks and their links. This makes the cryptography complex and immutable: If a hacker were to manage to change even one bit within a transaction in a block this would quickly be noticed by the nodes overseeing blockchain integrity.
  3. The blockchain needs to be collision resistant in that it cannot have identical hashes within the chain. The hash output needs to be unique to the input and not a match to any other hash to the degree that it may be concluded that a matching hash indicates its reference to the the same exact input. This is one of the reasons the cryptography has to be complex overall. The Birthday Paradox indicates that if you have a number of comparable items representing a subset of items with chronological attributes that is the square root of the total unique items within the larger set, there is a 50/50 chance of there being a duplication somewhere within the subset. Therefore, the hash has to pull random factors from an exponentially large pool of numbers as it uses the hash formula in order to insure a unique output that avoids a collision with an output with the same hexidecimal (base 16) code.
1 Like
  1. Is a mathematical function that takes an input and returns an output of preset length.
  2. Hash functions are used in crypto to deal with large transaction volumes more rapidly and efficiently. By hashing blocks of transactions, we get an efficient way to track a transaction. Additionally, because cryptocurrencies use cryptographic hash functions, these blocks are tamper-resistant. A change in a single block would be immediately noticed because it would change the hash of every block downstream.
  3. That it is extremely hard, but not impossible, to find a case in which two different inputs result in the same hash.
1 Like