Homework on Hash Functions - Questions

So they don’t generate the same hash value.

1 Like

A function that has a unique input and a unique output, that is one directional.

Hash functions are used in cryptocurrencies to write transactions on the blockchain through mining :]

Being Collision resistant means that you will not be able to find two inputs that have the same output.

1 Like
  1. Hash functions are one-way functions. Each unique input will produce/give a unique output or a fingerprint.
  2. Bitcoin mining uses cryptography, with a hash function called double SHA-256. A hash takes a chunk of data as input and shrinks it down into a smaller hash value (in this case 256 bits). With a cryptographic hash, there is no way to get a hash value you want without trying a whole lot of inputs.
  3. Collison resistance means that it is difficult to find any two messages or inputs that hash to the same output/value.
1 Like
  1. Hash functions are complex functions where an input creates an output. They are one way in nature, you cannot determine the input based on the output, only input determines output.

  2. Hahing in cryptocurrency takes an input string of any length and gives out an output of a fixed length. In cryptocurrencies like bitcoin, the transactions are taken as input and run through the hashing algorithm SHA-256 which gives an output of a fixed length.

  3. Being collision resistant means that no two inputs can result in the same output.

1 Like

Homework on Hash Functions - Questions

  1. Describe hash functions with your own words

A hash function is a set of mathematical operations (algorithm) that will convert an input of any length into a unique output of fixed length known as the hash or digest. In the case of SHA256, the hash is 256 bits, which is then converted to a 64-character hexadecimal string. While SHA256 always produces the same hash for the same input (it is deterministic), the function is one-way (you cannot determine the input from the hash).

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

Hash functions are used to perform various related functions. In the case of bitcoin specifically, the SHA256 hash algorithm is used to provide Proof of Work (which adds new transactions to a block, confirms the transactions as spent, links the new block to the previous block in the chain and then broadcasts the new block to the other nodes, which will then add the new block to their local copy of the ledger). The bitcoin protocol uses SHA256 to generate transaction IDs and uses these IDs to generate a Merkle root as the block ID. With SHA256 underlying the PoW mechanism, it also helps ensure the security, immutability, synchronization and efficiency of the distributed ledger and provides a way for nodes on the blockchain network to compete for rewards, thus incentivizing them to help maintain the integrity of the network. Another kind of crytography (elliptic curve cryptography) is used to generate public keys (used as “addresses”) and private keys (used as digital signatures), which together are used to track and prove ownership and authorize each transaction. First, you generate the private key using a “seed phrase”. From the private key, you compute the corresponding public key and by hashing that public key you get your address. Because public and private keys are not directly linked to a person’s real identity, they also provide privacy and pseudonymity.

  1. What does it mean when we say that hash functions need to be collision resistant?
    A collision occurs when more than one input to a hash function generate the same output. This is usually expressed as H(a)=H(b) where a=/=b.

When we say a hash function needs to be collision resistant, we are saying that the hash function must always provide a unique output. However, every hash function has more possible inputs than outputs. For instance, SHA256 produces 256 bits of output. Since it must generate one of 2^256 outputs for each member of a much larger set of inputs, it is guaranteed that some inputs will hash to the same output.

Therefore, collision resistance does not mean that no collisions exist; simply that they are hard to find. In the case of SHA256, an attacker using a brute-force would need perform hash functions on 2^126 random inputs (on average) to find two matching outputs. Since this is a very large number, we say SHA256 is collision resistant (rather than collision proof). Collision resistance is vital for maintaining a distributed ledger where each transaction ID and block ID is unique.

1 Like

A hash function is a mathematical function where the user creates a variable length input and receives a unique output. The slightest change to the input will completely change the output.

The bitcoin hashing algo is used to create a fixed length, secure and unique output.

Collision resistant means 2 different inputs can never generate the same hash

1 Like
  1. Describe hash functions with your own words
    we can encrypt every input data into unique output data with same length. It doesnt matter whether input is short word or whole book. Every small change in input means that output is completele different. It is one way function, so it is not real encryption. We cannot find out input word based on output. If we can do so, we will break bitcoin and crypto.

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

every transaction is encrypted by SHA256 /Secure Hashing Algorithm/ and add to blockchain.

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

sometimes two different inputs get same output. Changes that this will happen are astronomical, but it is not impossible.

1 Like
  1. Describe hash functions with your own words
    Answer: Hash functions are functions who takes as input a string and creates an output based on a hashing algorithm. The result is a fixed length number, usually in base 16, or 64 (or other base)
  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: Hashed functions in cryptocurrencies such as bitcoin are used to create transactions that can not be changed
  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: This means that two different inputs has little chance to produce the same output
1 Like

Hash functions are used to change inputs and data into cryptografiy and output can not be changed.
it is a one way function.

They are used to protect the network and private keys etc.

It means that two different inputs can have the same outputs but probability is too small

1 Like
  1. Every data input gives unique hash output.
    2.All transactions are hashed together in one block with unique fingerprint together with fingerprint of previous block. if any data will be changed in previous block , it will change the fingerprint and the chain will reject it.
    3.It needs to be sure that there is no way to get same output from two or more different inputs.
1 Like
  1. Hash functions are unique functions where a unique input gives a unique output, and you cannot put in an output to get the input.
  2. Hash functions lend themselves to things like blockchain because you cannot go back and use the output to determine the input. This helps blockchain be a permanent ledger. You can build upon this by inputting a blockchain to build the next blockchain. Essentially, you can use the unique output from one input as a separate, unique input and build upon that.
  3. It means that you cannot get an output from different inputs. Only one input will give an output, in this case a hash.
1 Like
  1. Hash functions is a unique identifier, or an output of an input, that cannot be reversed. The output cannot be used to identify the input.

  2. Hash functions are used in bitcoin to verify certain things, make them public, without actually disclosing certain private information that is meant to be kept secret.

  3. The outputs of each unique hash functions inputs cannot, and should not be the same of any other.

1 Like
  1. Hashing is when you take for example a sentence you then create a unique fingerprint of that sentence in the form of a Hash.

  2. Is it because its almost impossible to crack. To do with the mining and POW. no one so far has been able to find out the input from looking at the output.

  3. This is when two inputs are rarely the same on the same time being created.

1 Like
  1. Hash functions allow you to enter a unique input that will give you a unique output. The SHA-256 gives you a 256 bit output.

  2. Hash functions are part of the block hashing algorithm that is used to write transactions into blockchain via mining.

  3. Collision resistance means that is “infeasible” to find two input that hash to the same output.

1 Like
  1. In a hash function each unique input gives a unique output. It is like a one way function and you cannot go from output back to input.
  2. Hash functions are used in cryptocurrencies like bitcoin to write new transactions onto the blockchain
  3. A hash function is collision resistant if it is hard to find two inputs that hash to the same output
2 Likes

A hash function is a function that always produces a fixed size output for any given input. The output of specific input must always be the same. Depending on the output size, a hash function may return the same result for different inputs.

Hash functions are generally used to check the consinstency (here: meaning that nothing has been changed, is un-altered) of a specific data-set. In bitcoin it is for example used to link blocks together, since any block contains the hash of the previous block, meaning that is is possible to check that the previous block has not been changed. This also means that the hash of a block can be used to identify it. Changing anything in a block means also changing it’s identity and therefore also breaking the chain.

I think hash functions are surely also used for signing, but i think not required for encryption (?!).

Collision resistance means that the possibility to get the same hash for different inputs is low. If the input size is greater than the hash result you will always have such collisions. The other way round, collision resistance means that it is very hard / difficult to find different inputs that have the same hash result.

1 Like
  1. A hash function gets an input and creates a unique output of a sequence of hexidigest numbers. Each alteration in the input leads to a completely new hash.
  2. Every transaction of a cryptocurrency is captured in a block. Each block contains his own hash comparable to a fingerprint and the hash of the previous block. Via the hash of the previous block the blocks can be conected.
  3. It means that is hard (not impossible) to get the same hash for two different inputs
1 Like

1. Describe hash functions with your own words
A hash function takes an input and converts this into a fixed length output. This is a one-way function; it cannot be reversed to find the original input by putting in the outputted 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).
With cryptocurrencies the transactions are the inputs that are hashed using the hashing algorithm SHA-256. This hash function gives an output of a fixed 256-bits length.

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 hash function is collision resistant when it is very hard to find two inputs that when hashed have the same output.

2 Likes

1. Describe hash functions with your own words

A hash function is a process that takes an input of any length and changes it into an output of a fixed length. It is easy to take the input to an output, but it isn’t possible (at least not currently) to reverse

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

Every transaction on a cryptocurrency blockchain is hashed using a hash function. These hashes are then hashed together in a Merkle Tree which is then hashed with a nonce, which is then hashed with the hash of the previous block to give the block “address”. A key feature of a good hash function is that any small change in the data being hashed leads to a large change in the output hash. This means that any data change in block will change the hash of the block considerably, which will then affect every other block in the onward chain (if the block is not at the head of the chain).

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 occurs when 2 different inputs give the same hash output. A collision resistant hash function is a function that very very rarely gives 2 different inputs the same output hash. No hash function is completely collision free, but it should be so rare that it doesn’t cause a problem.

1 Like

1 - A 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. Ideally you should not be able to guess the intput from a given hash or output.

2 - In bitcoin they are used in mining as Well as in adress generation.

3 - Hash funtions must be secure enough so that it becomes extremely improbable to obtain the same hash output from two different intputs. With SHA-256 we assume that if the outputs H(A) and H(B) are the same so their intputs A and B are also the same.