Homework on Hash Functions - Questions

It does not have to be an address. A hash function takes any sort of input and gives us a fixed output. Try it yourself: https://emn178.github.io/online-tools/sha256.html

The question referred to the hash functions in general. A collision resistant hash means that it is impossible to find 2 different outputs that will give the same output. :smiley:

I am not sure what you mean by the input being huge. Hashing the blocks makes the network secure. You will learn more about this as you go on with the course. If you need any help feel free to message me. I will try to explain everything to the best of my abilities. :slight_smile:

  1. It is unique fingerprint of any possible string.

  2. Hash functions used as a way to write new transactions into blockchain.

  3. Collision resistant means, that two different input can’t get one similar output. Theoretically it is possible, but infeasible to achieve.

  1. Hash functions in bitcoin do not contribute to anonymity.

  2. Of course. But collisions resistant means that one hash function should not be able to have 2 different inputs that will give the same output. :smiley:

Exactly. Unless their is a vulnerability in the hash function. For example search up MD5 Hash Collision Vulnerability. :wink:

Very good. Short and on point. Keep up the great work! :fire: :fire:

No no. We have to keep the transaction data alongside with the hash of the block. That way if anyone tampers with the data in the block, the hash will change and we will know someone tried to change the past. There is no way to go from the hash back to the input if we lose it.

You can’t send messages over the public network using the hash function. No one can go back from hash to the input. In order to do such a thing you need to use public and private key cryptography.

  1. i meant key as *hash which is unique, mistaken there
  2. yes agree
    thank you for your time to reply, apreciate it.
    ps no need of loughing, im new to the terms, sometimes they mix when new informations comes.
1 Like

They hash. Encryption is something different. :smiley:

1 Like

Of course. It was just a friendly smiley face. Keep up the good work. :muscle:

Very nice way of saying it. Great job. :smiley:

We have to keep the input data and the hash. Since we can’t go from the hash back to the input we need to remember it. If anyone tampers with the data the hash will change and we will know the data has been tampered with. :slight_smile:

Not true. While we do use digital signatures to authorize transactions on the blockchain, they are not based on hash functions. They are the part of the public and private key cryptography. Public and private key cryptography enables us to have a 2 way function. Which means I can sign something with my private key and you can check that I signed it using my public key. Hash functions are one way fucntion, which means there is no way for anyone verify an output.

Hash functions are used to secure blocks in the bitcoin network. Miners create hashes for the blocks. We keep the block input data and the hash together, so if anyone tampers with the data we will know it. And this is all secured by electricity work miners do.

Everything you said in the second answer makes perfect sense, just replace it with the public and private key cryptography.

  1. A hash function is a unique output that secures a certain input
  2. bitcoin uses hash functions to secure the data so that the integrity of the chain is in place. Therefore, if someone were to attempt to change the block, they would not be able to as it would not only require that all previous linked blocks be changed, but also since the SHA256 hashing method is not yet vulnerable, that is you cannot go from an output to an input, you could not achieve this anyways
  3. Collision resistance refers to the low probability that two inputs will hash into the same output. So if I hashed the input a, it is very unlikely that a would be discovered to be the input by another person, such that a equals a SHA256 string of values
1 Like
  1. Hash functions are mathematical functions used in cryptography to verify the integrity of data. By converting identical data/input (of any size) into a unique output, giving it a unique fingerprint (a fixed size code).

  2. Hash functions are used, in the case of cryptocurrencies like bitcoin, to establish that the broadcasted data was not corrupted during transmission, to verify block integrity and to establish the chronological order of the blockchain. They are part of the proof of work (PoW) algorithm, used to mine some types of cryptocurrencies, like Bitcoin.

  3. Collision resistance is a property of cryptographic hash functions. It means that different inputs should never generate the same output/hash. However, it doesn’t mean that no collisions exist, it just means that it is difficult to find them. Hashes are very difficult to reverse engineer, to find its input value.

1 Like
  1. Describe hash functions with your own words:

Hash functions are unique inputs big or small that it will get back a unique and tailored output directly reflecting 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).

From what I’ve gathered, Hash functions are used to encrypt each block that’s connected to the blockchain. Every following block generated and added to the chain is also encrypted. using SHA256 no matter the size of the input, a fixed output will be the final product. the last block generated has a timestamp along with all the same information from the previous block and ready for new input.

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

From what I’ve gathered, the need to make sure the hash needs to be collision resistant means that no matter how many unique inputs are put in the hash function, that the output of them are rarely if ever equal. if more than one unique input has the same/shared output, there could be a serious flaw in the hash and that there are more options to break the algorithm besides brute force.

i hope i’m write, open to corrections!

1 Like

tks a lot, I’m studying like a Mad hahahah All this coding world is new for me, it helped me a lot! :=)

2 Likes
  1. Hash function is a function where every unique input has a unique output, and the formula of the function from output to input cannot easily be determined.
  2. In cryptocurrency, it is used in mining: when a computer solves for a specific target hash, the miner gets currency and the block is added to the blockchain.
  3. Collision resistant means it’s hard to find two inputs that get to the same output; critical as if two inputs had the same output two different transactions could be seen as one.
1 Like
  1. Hash function is a mathematical process that creates a fixed-size unique ID for each unique data set of any size. Hash functions cannot be reversed engineered.

  2. Hash functions are used in bitcoin as follows: the input data is comprised of the new not-yet-confirmed (meaning: not yet added to the blockchain) data-set plus a timestamp plus a reference to the previous block plus an additional arbitrary input data added by the miner in order to result in an output data (Unique ID) that conforms to the bitcoin protocol (proscribed number of leading zeroes in the resulting Unique ID).

  3. Hash functions need to be collision resistant (meaning, two or more set of unique datasets resulting in the same Unique ID) in order to preserve the integrity of any particular block.

1 Like

Haha no problem. I’m the same way. Been at it a few months, and there’s always something new to learn. Happy to answer any other questions you may have if I can.

1 Like