Homework on Hash Functions - Questions

  1. Describe hash functions with your own words

Hash functions are functions that return a unique output (hash value) for any given string. They are one-way functions in the sense that you can’t deduce the input based on the output.

  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)

They are used to maintain the integrity of the blockchain. The header of every block contains the SHA-256 hash of both the block header of the previous block and the root of the merkle tree (which, as far as I can tell, is obtained by first hashing individual transactions, then forming pairs of hashes by adding them together and hashing that value. That process is repeated until we arrive at a single hash value, which is called the merkle root).

This has several uses. Firstly, it enables us to efficiently verify whether some data is a part of a block. Let’s say that we have data A with the hash H(A) and we want to know if it belongs to a block with the merkle root of H(AB+CD). Provided we have access to H(B) and H(CD), we can plug in H(A) and compute H(AB+CD). If that hash value is the same as the corresponding value on the block, then, given that SHA-256 generates a unique output for every input, we can deduce that A is a part of a block.

Secondly, the fact that every block contains the hash of the block header of the previous block ensures the immutability of the blockchain. If one, for example, were to change just one bit in the first block of the bitcoin blockchain, the hash of of the block header of that block would change, which would invalidate all of the following blocks that build upon that hash value.

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

It means that it should be infeasible to find inputs that correspond to the same hash value. Since the potential hash values of SHA 256 are limited (2^256) and potential inputs are unlimited, there cannot be a unique hash value for every potential input. In practice, finding collisions needs to be extremely difficult for the blockchain to be secure. For example, as far as I can tell, if one could easily find data with a hash value that collides with a preexisting hash on the blockchain, one could claim that this data is a part of the blockchain.

1 Like
  1. Describe hash functions with your own words
    Hash functions are in some way related to simple mathematical functions as the consists of input and output. It basically transform any unique input into an unique output. Each input gets a “digital fingerprint” so for example an input of number 1 gets a unique output. The output for number 1 is always the same (it is deterministic). In the case of SHA256 the output will always result in 256bits.

  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 bitcoin blockchain, each block has its own hash. Also all the data in the block are hashed. Furthermore, it is used in the database structure of blockchain when we are refering to previous block, by the usage of hash pointers.

  3. What does it mean when we say that hash functions need to be collision resistant?
    It basically means that there should be negligible chance that two different outputs generate the same output.

1 Like
  1. Hash functions are one way conversion system from input to output and can not be converted back from output to input.
  2. Hash functions used in cryptocurrencies like bitcoin are applied in transactions as input and run through in SHA-256 which gives an output of a fixed length.
  3. It means that each unique input should provide different output so that multiple unique inputs don’t collide to generate the same output.
1 Like
  1. Hash functions take in an input of any size and outputs code of a fixed size that represents the input. A hash function can only flow input to output and not vice versa. A hash function should never be able to be traced backwards (output to input).
  2. Bitcoin uses hash functions to maintain data integrity. Hashes are used to identify data and run computations.
  3. Collision refers to two bitcoin addresses generating the exact same address. To be collision resistant the blockchain must take measures to avoid this situation. Since collisions are fundamentally inevitable at some point, bitcoin has made it incredibly unlikely to happen.
1 Like
  1. Describe hash functions with your own words
    A hash function applies a cryptographic transformation to an input data set and outputs a signature, where the signature size is based on the hash function

  2. How are hash functions used in cryptocurrencies like bitcoin?
    Bitcoin uses hash functions to cryptographically validate the linking of the blockchain, making it immutable.

  3. What does it mean when we say that hash functions need to be collision resistant?
    Collision resistance means that the probability of two inputs to a hash function is not likely to produce the same output hash signature.

1 Like

1.Hash functions are a way to create a unique digital fingerprint without being able to trace the input.
2. In Bitcoin hash functions are used in mining to write new transactions on to the blockchain.
The inputs are the unconfirmed transactions.
To solve the block the miners must combine all the inputs with data of their own so the outputs start with a certain amount of zeros.
Lot of computing power required
3.collision resistant means that two hashes have a very little chance of creating the same output

1 Like

1: Hash functions are one way functions where each input produces an output, each one unique.
2: A hash function in Bitcoin is used to hash transactions in each block and when a new block is added, then the hashing of the old block is added to the new blocked and all hashed together.
3: Meaning that is very difficult to find 2 inputs that produce the same output in a hash function.

1 Like
  1. A hexidecimal output is made by using a mathematical function on a piece of data (f.eg a sentence or a datafile)-

  2. In proof of work, a one way hashing functin is used so the initial problem solved (input) is not revealed. In this way the network is secure.

  3. Collision resistance prevents any 2 identical hashing outputs. Needless to say, 2 different inputs with the same out put would cause a conflict error in some way.

1 Like
  1. A hash function provides a signature (hex number) of a given input (string). It is pre-image resistant (one way function).

  2. Fundamentally each block (part of the ledger) comprises bitcoin transactions which can be looked at as an input string. The hash function takes this input and provides a hash (signature). The found signatures are included in the next block and as such providing chain (hence blockchain).

  3. Collision resistance means that it is infeasible H(A) and H(B) provide the same output.

1 Like

Hash functions can take an input of any lenght, and will produce some specific fingerprint (no matter how many times you enter the same input, it will always produce the same result. But with this result, it’s impossible to calculate the original input.

In Bitcoin we use this to fuse blocks together in mining etcetera

1 Like

It produces a 64 digit hexadecimal number wich is 256 bits long (in binary)

1 Like

*that no 2 different INPUTS generate the same output.

Probably a typo :wink:

This is not about addresses. Just that no 2 inputs of whatever you want to hash can produce the same output (fingerprint)
Many types of data gets hashed using Sha256 in Bitcoin. (transactions, blocks,…)

1 Like
  1. Bitcoin uses hash functions for transactions that occur and records them into the blockchain and also for the data structure by connecting the previous block to the next which allows for better efficiency and security. :grinning:
1 Like
  1. Hash function is an amazing process in creating a very secure network.

  2. Hash functions are the building blocks of cryptocurrencies like bitcoin.

  3. It means that it is very difficult to have two different inputs from the same hash.

1 Like

1- Hash functions are functions that take unique input and give a unique output, a digital fingerprint of a fixed length. They only operate in one direction. You cannot determine the input from the output.

2- Hash functions are used in cryptocurrencies by securing transaction data during the process of transmission keeping it safe from tampering.

3- When we say that hash functions need to be collision resistant, what that means is that each input has its own unique hash which would make it highly unlikely for another to come up with the same hash (output).

1 Like
  1. An arbitrary length mathematical function with the output always being a fixed lenght
  2. They’re used to verify a trans action is true before it can be entered in \to the blockchain
  3. Two different inputs can’t have the same output
1 Like

Homework on Hash Functions - Questions

1. Describe hash functions with your own words

A hash function is a computational process wherein a distinct input results in a similarly distinct output, which is a digital fingerprint of the original data.

The same input will always generate the same output, and the process is unidirectional, in that the output cannot feasibly be used to work out the input, due to the use of algorithms such as SHA-256 (secure hashing algorithm, 256 bit), which hashes the binary form of the inputs alphanumerical characters into a hexadecimal (base 16) 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).

The SHA-256 hashing algorithm was invented by the US National Security Agency in 2001, and is utilised by the Bitcoin blockchain for its unique hash value, high hashing speed, and secure hash function.

Hashing is used in Bitcoin mining to hash the block header, in an attempt to obtain a value equal to or less than the target difficulty. If successful, this block is added to the blockchain, and the miner is rewarded in Bitcoin.

The hashing process is also used to create Bitcoin addresses, in that the public key is hashed to create a shorter, more convenient, and more secure string of characters to create the Bitcoin address.

As well as this, hashing can be used to for the comparison of data, as the same input will always result in the same output - if the output is different, that means that the data was tampered with somehow, and therefore reveals it’s inauthenticity when compared to the original data.

Lastly, hashing is also used to reduce the data size of transactions sent over the network, wherein the data contained within the transaction is encrypted using the sender’s private key and then hashed, instead of just sending the private key-encrypted data.

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

Collision resistance is the low likelihood that two different inputs to the hash function will result in the same output. Eventually, input collision would be inevitable, but due to the amount of time, hash rate and processing power required for the collision to be likely, the attacker would not live long enough to reap the benefits of breaking the encryption through this method.

1 Like
  1. Describe hash functions with your own words
    A function that takes an input or string of any size to a fixed size to the output
  2. How are hash functions used in cryptocurrencies like bitcoin?
    In blocks or transactions because you always have a fixed size. ( resume of the data)
  3. What does it mean when we say that hash functions need to be collision resistant?
    Is impossible( in this context is more properly say that is infeasible) that two inputs have the same output
1 Like
  1. A hash function takes in a string and converts into a string that is indecipherable. Thereby securing this initial piece of string. Importantly the same input will always give the same output. But, a small change in the input will change the output drastically, making the input extremely hard to reverse engineer.
  2. Hash functions are use for different things on Bitcoin. Every new block of information contains a hash of the previous block. To change a hash of the last block mined would require you to change the hash of every block mined before that. Making the integrity of all the information extremely secure.
  3. Collision resistance is about taking an output and trying to find the same input or taking a different output that results in the same input.
1 Like