Homework on Hash Functions - Questions

Exactly. My mistake. I should have mentioned that it is 64bytes when it is displayed in hexadecimal format. :slight_smile:

1 Like

That’s it. Keep up the great work. :slight_smile:

1 Like
  1. One way function (input cannot be generated from the output) generating a unique output for every input. Slightest change in put leads to a different output - length of output always the same however regardless of input length

  2. Hashing is used to create bitcoin addresses.

  3. Collision resistance means that you will not be able to determine input by testing random inputs until you get the existing hash of an unknown input - it would take a practically infinite amount of time for probability of success to be significant.

1 Like

Hash functions can’t encrypt data. Thy can only hash the data. Hashing is a one way function and encryption is a two way function. :slight_smile:

Is a hash function collision resistant if we can find 2 inputs that produce the same ouput?

Hash functions are indeed used in bitcoin to generate a public address, but they are not used to generate neither the public or private key. They are generated with the elliptic curve cryptography algorithm. The main usage of hash functions in bitcoin are used in the bitcoin mining. Miners secure transactions by hashing the blocks. :smiley:

1 Like

Correct. However, the more important part is in the mining. We hash all the transactions in the bitcoin, making them immutable. :slight_smile:

1 Like
  1. Hash functions are one way functions where each input produces an output.

  2. Hash functions are used to hash transaction data and for mining.

  3. Collision resistance means each input is transformed to unique output and probability of two different inputs transforming to same output is infeasible if not impossible

1 Like

Hey Mauro. Thanks for the reply and thanks for the clarification. As the studying continues, the more I become interested, in diving deeper into the more difficult parts of crypto, that most may not feel the need to understand.

1 Like

Hash functions are mathematical functions that take the input data and process it into a fixed length. A hash function is a one way function. Input formulates output, but output cannot formulate the input. Cryptocurrencies have security added to typical hash functions, called cryptographic hash functions. Cryptographic hash functions also allow for anonymous transactions. Bitcoin uses SHA-256 cryptographic hash function in its algorithm. Cryptographic hash functions create a digital fingerprint, because each unique input produces a distinct output. Hash functions need to be collision resistant meaning no two input hashes should formulate the same output hash; necessary for checking the integrity of messages and to authenticate information. Collision resistant is one of the three necessary properties of cryptographic hash functions.

1 Like

1- A hash function is an algorithm called : SHA 256 that will convert any string of data long or short into a 256 bit hash which is a unique foot print of the data just converted but it is (infeasible) to use the hash to determine what the input is by working backward.
2- Hash function are use in cryptos. to achieve immutability because a simple change in a data in any record will result in drastically different hashes affecting all the blocks on the chain, which is impossible.
3- Collision resistant refers to the fact that it is infeasible to come up with the same H ( ) as numbers increase on the network, infeasible not impossible but the probability of that happening is so small that it is safe to assume That if H (a) is equal H (b) a=b .

1 Like

Keep it up. It will all be very clear in the end. You are doing a great job. I am happy to see that you are exicted. :smiley:

Bitcoin transactions are not anonymous. Transactions are hashed in order for us to make sure that no one tampered with the data. All transcactions are public and visible to everyone. :slight_smile:

3 Likes

Thank you! I see how what I wrote contradicts the transparency of the Bitcoin ledger (I think.) But I thought anonymity was an important feature of Bitcoin. In the article I read to help answer the questions, it states “Cryptographic hash functions are widely used in cryptocurrencies to pass transaction information anonymously.”

I am trying to understand and use correct terminology, but it looks like I misunderstood. Can you help clarify?

Bitcoin was never meant to be an anonymous currency. In a way, we can say that bitcoin is a pseudonymous currency. While you are able to track every transaction on the blockchain, you would still need to make a connection from a public address to a person. Bitcoin addresses do not contain any private information, but if I somehow managed to find out which one you control I could track you every move. There are ways for you to increase your privacy. This can be achieved by using many different addresses each and every single time, as well as making several outputs when actually making a transaction. (Usually automated by a wallet.)

In bitcoin, hash function is mostly used in mining. Hashing provides security. All transaction that are hashed are there for anyone to see. Bitcoin transactions are transparent as you can see which address/addresses sent to which address/addresses. I would agree with that definition you found. If you want to stay private, you should take a look at privacy coins such as Monero. Hopefully this all makes much more sense now. :smiley:

2 Likes

Hash Functions Homework

  1. In hash functions you take an input (transaction) run it through a hashing algorithm (SHA 256) and it gives an output of a fixed length. Instead of remembering the input data which can be large, you just remember the hash which is easier to keep track.
  2. SHA 256 is the underlying hash function used in bitcoin where you input info and the output is an alphanumeric string. The output is like a fingerprint of the input data so from the output you can’t recreate the input.
  3. Hash functions are collision resistant means that you can’t find two different input values that result in the same hashing output, or that for one input there will be only one output. By comparing a hash to a previous hash result can help us find out if something has been modified.
1 Like

Yes, you explained it very well! Thank you so much :grinning:

1 Like

You have to keep the input, otherwise the hash would have no meaning. The purpose of hashing is to provide a unique fingerprint of a file. In bitcoin we must keep the input data (transactions) alongside with the hash. This way we can make sure that the data cannot be changed in any way, as any change would generate a completely new hash. :smiley:

No problem. Keep up the good work. :muscle: :muscle:

Your explanation helps. Thank you!

1 Like