Homework on Hash Functions - Questions

Hash functions are different sets of mathematical encryptions where you have an input with an unique output. Hash functions as in sha 256 used in bitcoin transactions converts any data input into a sets of numbers from 0 to 9 and letters A to F (16 digits). It can not be reversed. It is used by the miners to connect the blocks. And it is also used in generating wallet address.

Collision (proof) resistance is must in hash functions. For example it’s hard to find someone in a restaurant with the same birthday as you are. Possibilities are very low or almost to zero. Every input must have its unique output. This makes the transaction more secure and feasible.

  1. Describe hash functions with your own words

it’s a deterministic function that will provide a sort of digital fingerprint of the input

  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 many ways in bitcoin, from creating public key and addresses to link blocks together in the blockhain and to create merkle trees inside the blocks to link transactions together

  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 for two given different inputs the output must be different, there are always possibilities for collisions but as the number of possibilities increases to a number so large that it becomes pointless to search then you can assume that if the output is the same then the inputs must be the same

  1. Hash functions are one way funtions that create an output (digital signature) from an input but cannot go from output to get the input
  2. hash function is used to hash transaction data. miners then guess nonces in relation to the hash on the block they are mining
  3. collision means that two blocks could technically create the same hash but the odds are astronomically high

It’s a way of putting a unique digital finger print on data such that a one bit change in data totally changes the hash. The finger print can not be used to work out the input
hash function can be used to generate for example private keys, to identify a block and make changing contents of block close to impossible

its highly highly unlikely that two inputs will produce same output

  1. Describe hash functions with your own words
    Hash function is a computation (Input) that produces a unique outcome from that computation, but that cannot be reversed.

  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, the transactions (regardless of data size) use hash function (SHA256), always gives an output of fixed 256-bits length, which makes it easier to keep track of things.

  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).
    With each input producing its own unique output, it makes hash functions highly collision resistant. That is needed to prevent the function from being hacked easily.

  1. Describe hash functions with your own words.

Hash functions are a way of encrypting data so as to be uni directional and immutable. They are created using an algorithm that generates a unique fixed length alpha numeric signature that is verifiable without the ability to compromise the data contained within.

  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 the bitcoin network is several ways. One of the ways is to link a chain of blocks of data that are constructed in such a way that each successive block has a specific component in its hash function that correlates to the one before it in a uni directional way. This means that each blocks unique hash function is a composite of the data contained within that block and some of the information from the previous block. This increases the mathematical improbability of a hacker to compromise the network due to the significant computational power needed to out compute the entire network for a long enough period of time to create a new chain that the system will reach consensus over. Another usage of hash function is to protect each individuals set of keys relating to their own account.

  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 resistance refers to the mathematical improbability of a miner randomly guessing the hash function of the current block being mined at any one time.

:slight_smile:

  1. Describe hash functions with your own words
    A hash function takes an input and converts it to a output, with bitcoin to a 256-bits output (using the SHA-256 standard).

  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 in bitcoin are used to hash transaction data. And to verify/link together the blocks in the blockchain.

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 if it is hard to find two inputs that can hash the same output.

  1. Describe hash functions with your own words
    A hash function converts an input to a string of letters and numbers. Every unique input has its own unique 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 to secure data contained in the blockchain blocks.

  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).
    It means that we have to make sure that every every unique hashed input has only 1 possible output. No 2 different inputs pay generate the same output.

  1. hash functions create a one-way unique fixed length output for any input.
  2. Everything in a bitcoin transaction block is hashed along with the previous block hash to prevent tampering of any data.
  3. It must be highly highly unlikely for 2 different inputs to create the same hash output.
  1. A hash function is a unique input that produces a unique output. If something is changed in the input , the output also gets changed.
  2. Hash functions is used to send transactions. One value in a wallet adress coded with private keys give a new output.
  3. The length of a hash function disables collisions. There are so many different possibilities. Two different inputs can’t generate the same output.
  1. It takes an imput(text ,data, information written down) and converts it into a unique code of numbers and letters, if you change the tiniest bit of the imput, an upper case letter for a lower case for eg the output code (hash) will be completely different.

1.hash funktions are cryptografic made algorims that take an input and gives you and output in one way where is it nest to inpossibel to go from the output to the input
2.in bitcoin hash function are used in such a way that each and every block is cryptografict likt to the previsoly block aswell as the next block meaning you cant tamper whit a singel block becuse the hole network would know becuse it hasent been verifyde be the miners as an legit transaction and becuse every block contains the hash of the previsley created block menaing the chain are only as stong as its weakest link but by using the sha-256 algoritmen whitin every block of transations you eleminating the possebillety of any weak link
3.it menas that the sha-256 needs to be determennisctic in its hash functions so that as littel colisions happens meaning that every input always give a total different output even do for ex it is just a singel dot that wast added and that is becuse of tha evalance effect whit in the sha-256 algorimen

1 Like
  • Hash functions provide a short-cut snapshot of a given state of a set of data by distilling the much larger amounts of information down into more easily searchable and verifiable chunks. It’s a type of shorthand compression for computers which both saves time and allows for very rapid checking of integrity of huge strings of information, without checking all the individual bits.

  • The H function must have the property so that it is not possible to determine the input if the output is known. It must ‘scramble’ the snapshot, making a ‘one way process’. In the case of BTC blockchain, the hashing has been performed on the previous block, and the resultant hash output will link the previous block to the new block. This ensures that the entire chain of linked blocks is linked by these hashed properties of the transactions of the block preceding it. There is no way back once the hash function has been made. One way of putting this is that if H(A) = H(B) then A=B. Otherwise, once hashed [H], even if there had been the slightest change in A, it should still never be exactly the same output after the H function. Hashing also needs to be both practicably fast as well as deterministic. Deterministic means that if the input is the same, the output is likewise always the same. There are many different hashing algorithms, some stronger some weaker - the current hashing algorithm used in the Bitcoin blockchain is called SHA-256. This is hexadecimal, which has 64 characters and therefore must use additional letters to represent numbers, and is both fast enough and secure enough for security and integrity - properties essential to Bitcoin. Whatever is input will come out as a 64 string combination of the following.

0 1 2 3 4 5 6 7 8 9 a b c d e f

  • Collision Resistance is a concept from the study of probability. As miners compete for blocks, the difficulty level of two distinct elements are in play. First, the level of cryptographic strength In the hashing - in this case SHA-256, and a second factor. For the security of the system and to make it fail safe, this second factor is a 32 bit character number which is included in the function of creating a hash, and this random number is called, somewhat unfortunately for colloquial London English speakers, a ‘nonce’. As above, it would be a problem if two different inputs to hashing (H) resulted in the same hashed output. Output A cannot equal output B after H. The probability of this occurring needs to be reduced to beyond unlikely, and the way this is done is by using these two elements in tandem. The complexity of the nonce can be increased or decreased if in the future, for example, quantum computing puts SHA-256 within reach of being cracked. What I can say is that the post picture hash is produced by adding the [snapshot or shorthand or] hash of the previous block to the nonce number of the current block to introduce a secondary random element. This combination is then hashed. I think it’s this that is ensuring the Birthday Paradox does not occur.
3 Likes
  1. Hash function has the property that given an input x, it will produce to unique out y, and it can’t be reversed back to x by given y.

  2. Hash function in bitcoin is used in the mining to produce new blocks and add the new blocks to the blockchain. Blocks are chained together by hashing the previous block data to achieve immutability. What’s more, miners have to randomly guess a nounce during the mining based on the mining difficulty.

  3. Collision resistant means you get the same output from two or more different inputs.

Homework on Hash Functions - Questions

  1. Describe hash functions with your own words

Each unique input gives a unique output.
This is always a one way function which means that you can never get to the unique input based on the unique 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).

Merkle tree

The bottom layer of a Merkle tree consists of the Bitcoin transactions. These are also called “leaves”. Each transaction is gehasht. So Tx0 gets Hash0, Tx1 gets Hash1, Tx2 gets Hash2 and Tx3 gets Hash3. The hashes are put together in pairs, and are then gehashed again. Hash0 and Hash1 are placed together to take a hash of them, Hash(0,1). The same is done with the hash pairs Hash2 and Hash3, resulting in Hash(2,3). Next, the resulting hashes, Hash(0,1) and Hash(2,3) are merged and hashed again, leaving only a single hash. This final hash is the Merkle tree root hash. This root hash is included in the block header hash.

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

A hash function 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. A hash function takes any string of data and converts it into a hex number.
  2. In Bitcoin the Hash function hashes the previous transaction data with the current transaction data.
  3. Two different things not getting the same hash.

(ECDSA) Eleptic curve cryptography is more vulnerable than reverse engeneer Sha256 with the quantum threat.
So never reuse bitcoin addresses, because you reveil your public key when you spend it.

Watch Andreas explaining this:

Is quantum computing a threat to Bitcoin? by Andreas Antonopolis

Awesome post by the way,

2 Likes

1- a one way function which is deterministic. Deterministic means that given a single input it will always provide the same output (= digital fingerprint for the given input). One-way function means that this function is so complex that you can not derive the input based on the output of the function.

2- In bitcoin the hash of the previous block is concatenated with the data from the current block and together they are hashed numerous time until the output which is obtained meets certain pre-defined criteria which corresponds to desired the difficulty level for mining which increase or reduces depending on how many computers/miners are participating to the mining (the more computer the higher difficulty in order to keep the number of accepted blocks to a certain limit/level).

3- It means that 2 different hash function inputs should not have the same hash output

Hash functions are unique in that you can get an output by entering an input, but you can not get an input by entering an output.

Cryptocurrency hash functions are used to verify the authenticity of a set of data. (ie. verifying that someone actually possesses a claimed amount of currency). Bitcoin uses a set of data to produce it’s unique hash output.

Collision resistant simply means that two identical outputs can’t be produced.

Thank you! Funnily enough I did start watching a different Anotonopolis lecture on hashing, but ended up with hash overload this morning, after a night dreaming about it ha hah But yes, I kinda grokked that I didn’t realise this fully before today - about the addresses, and made me go and dig up an older Ivan piece tying together the seed, public & private. I’m still not quite getting it straight in my mind’s eye, but I do understand what you point out - so am gonna have another full run through of that aspect tomorrow and will watch this then, Had so many breakthroughs with the rest of it that my head needs a break today. Thanks again :+1:

1 Like