Homework on Hash Functions - Questions

Homework on Hash Functions - Questions

  1. Describe hash functions with your own words
    A type of function that no matter the input the output is the same number of bits.
  2. How are hash functions used in cryptocurrencies like bitcoin?
    Each block’s contents are hashed and put into the next block, ensuring that if a block is tampered with, it would be easily recognized and affect all the blocks following it.
  3. What does it mean when we say that hash functions need to be collision resistant?
    When you hash 2 different inputs the outputs do not match.
1 Like
Describe hash functions with your own words

 A: A hash function is where an input gives a specific output or digital fingerprint which cannot be used in reverse order to find the input otherwise it's been compromised. 

How are hash functions used in cryptocurrencies like bitcoin?.

A: They are used to mine new blocks and miners must produce or solve a block with correct input data that starts with a 0

What does it mean when we say that hash functions need to be collision resistant?

A: It need to be highly unlikely that the output (hash function) matches with more than one input
  1. Describe hash functions with your own words

It’s a one-way complex function that outputs a unique “fingerprint” for the input. That input will always produce that specific output, but it is nearly impossible to derive the input from it’s hashed fingerprint.

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

The SHA256 hash function is used to produce the public address. The private address is the “key” or input to the SHA256 function that is used to cryptographically “unlock” access to the public address. So the private address is the “input”, and the public address or fingerprint of the private address is the output (the alpha numerical address where bitcoin is sent to). If you run the private address through the SHA256 algorithm (function) then you will get the public address as it’s resulting hash. In this way, crypto is secure if you only send money to the public address. The private address is the key used to gain access to controlling those funds. As long as the private address (key) is kept safe and private, then a brute force attack on this SHA256 hash is nearly impossible, and until quantum computers can do this, for all intents and purposes, it’s impossible to hack (at the current time).

  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 is the resistance of the algorithm to produce the same hash result for wo different inputs. It is possible, but the chances are astronomically low.

  1. Describe hash functions with your own words
    Hash function converts the input data of arbitrary length to the output data of fixed length. SHA256 is used to hash the data in the block in the case of Bitcoin.
  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).
    SHA256 hashing algorithm is used in bitcoin to hash the input (transactions) in the block before it gets appended to the previous block.
  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).
    Collision resistance is a property of hash functions which means that it is hard to find two inputs that hash the same output.
  1. Describe hash functions with your own words: It is a oné way mathematical function which encrypt the imput data safelly usinam 16bit system.
  2. How are hash functions used in cryptocurrencies like bitcoin?
    Hashes of data contained in previous block are included into new block to be safely linked into the chain.
  3. What does it mean when we say that hash functions need to be collision resistant?
    We generally suppose that each hash is Unique fingerprint of specific data, but It is not. It may happen from mathematical pov that two different imputs has the same hash. More collision resistant the hash is, less probability of this errors exist.

Hash functions can only hash data. Encryption is not the same thing as hashing. But you were close. Hash function are indeed used when we transact data over the bitcoin network. :smiley:

Exactly. This means that a slight change in the input should generate a completely different hash. No collisions should be possible. :smiley:

Kinda. There could still be a flaw in the hash function in itself. A weakness that may open up an ability to make collisions. For example, check MD5 Hash Vulnerability <— Click!

1 Like

Exactly. We hash the transactions in bitcoin. Later on you will learn more about why we do this. (If you haven’t already.) :smiley:

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

First off, I am sorry for my late reply. Once you set up a full node (288gb) you keep adding 1MB every 10 minutes. This shouldn’t be demanding even in the long run. Only thing a miner should be careful about, is that they don’t run out of the storage and that their equipment is profitable. :smiley:

1 Like
  1. Miners do hash the transactions. But the hash has to be lower then the difficulty target. There are no keys here.

  2. Again no keys. A collision resistant hash functions means that the 2 different inputs will not result in the same hash.

If you need any help in understanding this better. feel free to message me back. :smiley:

  • Hash functions take an input of data (text or numerical) and perform a complex calculation on that data to convert it into and output which has the appearance of a random string of numbers, which is always the same result for each unique input. The output is such that it is impossible to guess what the input was, giving it security and secrecy. The has output is always the same length but the input length can vary. If you change the input in the smallest way, such as a single character, the has output will look completely different.
  • An example of how hash functions are used is with public and private keys. If you take a private key (input) and hash it, the output can be used as your public key, so that people can send money TO your wallet address, but cannot send money FROM it. That is because they cannot ‘reverse engineer’ your private key using the hash.
  • Hash functions are collision resistant, meaning the odds of two unique inputs having the same hash output are so remote that it could virtually never happen. The hashes that produce longer outputs (such as SHA256 or SHA384) are more collision resistant than hashes that produce shorter outputs (such as MD4 or MD5).

Hash functions hash the data. Encryption is a bit different. :slight_smile:

In short, hash is a one way function and encryption is a two way function.

Yes. The key difference is that with the encryption you can go back if you have the key for decryption. Hashing is one way. :smiley:

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

Hashing isn’t the same as encryption. With encryption you can go back if you have a key for decryption. Hash functions hash and they can’t be reversed. :smiley:

A hash function shouldn’t have any loopholes. They may be highly complex. Do you mean SHA-1 2^1? If yes, then of course it wouldn’t be collision resistant. However when we say SHA-1 we refer to this: https://en.wikipedia.org/wiki/SHA-1

2ˇ160 I believe. :smiley:

Hash take an input, and give a fixed output. This output will be a unique fingerprint of that file. In bitcoin, we use hash function to hash the transactions in the blocks. This secures the blocks, as you will learn later on in the academy. If you need any help feel free to message me back. :slight_smile:

Collisions don’t happen with the hash functions, but with hashes in a given hash function. We shouldn’t be able to have 2 different inputs create the same output. :smiley: