Homework on Hash Functions - Questions

  1. Hash functions take any input and convert it into a unique output (the hash value). The same input will lead to the same output. The slightest change in the input will lead to a totally different output. That is important so that the input of a specific output cannot be computed or guessed (at least not with reasonable time and effort).

  2. It is used for mining. My biggest learning here is that my last sentence of answer 1 is wrong. The input can be computed and that is the core of mining. Whoever is the first one to identify the input of a given hash value, has mined a new block and will be rewarded with 12.5 Bitcoin. This solving of puzzles for mining is called proof of work.

  3. Unique input should lead to unique output. Once different inputs lead to the same output we have a collision. This needs to be avoided. It could create opportunities for attackers to cheat the system. E.g. pretend that certain transactions have happened.

They don’t have to be 256 bits. But in bitcoin we do use SHA-256. :smiley:

Hashing and encryption are not the same thing. “Encryption is a two-way function; what is encrypted can be decrypted with the proper key. Hashing , however, is a one-way function that scrambles plain text to produce a unique message digest.”

I assume you meant to say function, instead of a transaction. :wink:

Hash functions hash an input. Hashing and encrypting is not the same thing. “ Encryption is a two-way function; what is encrypted can be decrypted with the proper key. Hashing , however, is a one-way function that scrambles plain text to produce a unique message digest.”

Private keys are generated using the Elliptic Curve Digital Signature Algorithm.

  1. a unique fingerprint given to your data input
  2. hash functions are used to generate a fixed length output value that acts as a reference to the original data
  3. collision resistant hash function means you cannot have two different input values that would give the same output
1 Like

ANSWERS
1- Add unique inputs and receive unique outputs, this output is as unique as a fingerprint. The received output of 64 digits cannot be used in reverse to find the data that was applied to the hashing algorithm (SHA256 for BTC)

2- The SHA256 hashing function is used by Bitcoin to encode transaction data and store it on an open source ledger. The ledger (blockchain) holds historical data in strings, each transaction linked to all previous transactions. In terms of security the hashed data is extremely difficult to decrypt, even if you guessed the input data you would also need to guess all following transactions for your block to be accepted by the blockchain nodes.

3- Collision resistance in a hashing algo. means that collisions are very rare, so rare in fact that trying to create a ‘collision’ (trying to create an input to match an existing output) is said to be more difficult in SHA256 than a brute force attack. With SHA256 a duplication of an existing output is possible so improbable that its not worth perusing as an attacker.

1 Like

Hashing and encrypting is not the same thing. Miners try to guess a low enough hash in order for the block to be valid. This secures the block with work. You will learn more about this as you go on throughout the course.

1.hash fuctions are one way unalterable digital finger prints.
2.the hash function ensures that the data in the blocks and the mined coins cannot be altered without the nodes and miners noticing.
3. collision resistance represents the difficulty in mining to me where its hard for 2 different miners to get the same hash

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.
  2. Hash functions are part of the block hashing algorithm which is used to write new transactions into the blockchain through the mining process.
  3. It means each input will have its own unique hash making it very infeasible for H(A) to be equal to H(B).
1 Like
  1. A hash function is a one-way function in which each unique input generates a unique digital output. You cannot determine the input from the output. Changing one single variable in the input will generate a completely new output that looks entirely different from the original one.
  2. Hash functions are used to hook the transaction details (amount, time, date, location) with the previous block in the chain before they are inputed and verified in the blockchain.
  3. Collision resistance refers to avoiding the rare odds of two different inputs creating the same output.
2 Likes

A hash function is a one-way function. From a unique input to unique output creating a digital fingerprint.

SHA256 is the hash function used by Bitcoin for transactions, security and data integrity.

Hash functions has to be collision resistant to prevent hackers and people being able to solve the input from the output which is what happened with the MDF hash function and is why no one uses it any more as it is no longer secure.

2 Likes

Hash functions are mathematical tools that convert input value(s) into a single hexadecimal output value. The rule for the hash function is typically its descriptor.

Hash functions are used to encrypt transaction data in each block and is the glue to piece each block together in a linear fashion on the blockchain.

Hash functions need to be collision resistant for security. They are not collision ‘proof’ as each value to be hashed must be something FINITE, that is, an infinite value cannot be hashed (I am not a math wiz so this could be complete BS, lol)

1 Like
  1. Hash functions are one way functions where each input produces an output or digital fingerprint.
  2. Hash functions in Bitcoins are using in mining for new transactions on the blockchain. The inputs for the hash function are the unconfirmed transactions plus additional data related to time and the previous transaction. To solve the block miners try to combine all of the inputs along with data of their own so the outputs start with a bunch of 0’s. It takes a lot of computing power and guessing
    3.Collision resistance means that is very difficult to find 2 inputs that produce the same output in a hash function. This is an important property in cryptographic hash functions.
1 Like
  1. hash functions compute an input and results in a 256 (hexadecimal) number. This is a fingerprint of the input. The output will always result in the same output.
  2. the hash functions are used to create the chain in the blocks. And are used to create a fingerprint of the information in order to verify the originality of the information.
  3. collision resistant is reducing the chance of an equal uitput for different input.
2 Likes

1. Describe hash functions with your own words
A hash function is a one way mathematical function that transforms an input (variable length) into an output (fixed length). The input can determine the output, but the output cannot determine the input. Hash functions should be deterministic (ie. If you put the same input you should always get the same output), should be capable of returning the hash quickly, be collision resistant and puzzle friendly.

2. How are hash functions used in cryptocurrencies like bitcoin?
To generate private and public keys, in mining blocks, recording transactions on the blockchain

3. What does it mean when we say that hash functions need to be collision resistant?
Each input will have its own unique hash. 2 Inputs that have the same hash is known as a collision - no hash function is collision resistant, but it usually takes so long to find a collision that it is safe to assume that a function like SHA256 is collision resistant.

1 Like
  1. An input is encrypted into a datastream which has a fixed length in its output. This means that it is harder to deduce the original input and its encryption. A small change to the input will result in a radically different output, thus making interference easy to detect. The hash is like a unique fingerprint.
  2. Hash functions are used to maintain the integrity of Bitcoin mining.
  3. Two different inputs should not produce the same stream of data as an output.
1 Like
  1. Hash functions are a one way (as far as we know) function that produces extremely unique output for every input.
  2. Hash functions are used to map data (time, amount, addresses) to fixed output
  3. Collision resistant is when it is hard for two different inputs to have the same output.
1 Like
  1. Describe hash functions with your own words
    A hash function is a mathematical function that when applied to an input produces a unique output for that input. from the output it is not possible to determine what the input was.

  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).
    SHA 256 is the hash function that is used in Bitcoin, every transaction (ledger) will be hashed together with the hash of the previous block to create a new block. And so on. This way, when a previous block has been altered, the chain will be invalid.

  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).
    You need to be sure there is no chance to have 2 different inputs generating the same output hash. When this happens it is called a collision

1 Like
  1. An input of data like numbers, letters that gone thru mathematical equation and outputs a hash.
  2. Used as proof of work in mining bitcoin.
  3. So its hard to find 2 inputs that hash the same output therefore eliminating the risk of predictable collisions.
1 Like
  1. Hash functions are mathematical computations that take an input and put it through a formula to create an output that is always the same if the input is the same.

  2. They’re used to create the immutability of the bitcoin blockchain. In other words, they are one way cryptographic functions that cannot be reversed.

  3. A collision happens when two hash function outputs based on two different inputs are the same. The birthday paradox is a good example. To make sure the hash function is collision resistant means that the formula for the hash function needs to output a result with a large enough space in it that each output has minimal chance of resembling another output.

1 Like