Homework on Hash Functions - Questions

That is true, that is why they are so useful for the blockchain :smiley: but what is their purpose there? :wink:

1 Like
  1. Hash functions take in an input and convert it into an output with a fixed length.

  2. Bitcoin uses SHA-256 which contains base-16 characters. What makes this hash function so usable is that it can only be converted one-way. An input returns the output, but you can’t get the input given the output.

  3. Collision resistant refers to hash functions with different inputs also having different outputs. You don’t want different inputs having the same output.

1 Like

Please correct me if I am wrong on any of this!

  1. There are many different hash functions, and the role of a hash function is to take a certain input given (of any length) and offer a unique digital fingerprint (of a fixed length) which is the output. If even a single bit is changed, the output is completely different, but still a fixed length. There is no way to go from output back to input. This is one of the main security features of hash functions and what makes blockchain technology so unique and reliable.

  2. Bitcoin uses the hash function called SHA-256 and its role in cryptocurrency is crucial to the Proof of Work algorithm used when mining. Miners try to “solve” a block by hashing inputs with a nonce (arbitrary string) in the hopes that the resulting hash starts with a certain amount of zeroes. (I’m not sure if I got that completely right!)

  3. A collision is when two separate inputs produce the same output. To be collision resistant in a hash function means it is hard to find two inputs that produce the same output.

To make data fit a certain size like SHA-256 makes data 256 bits.
@Alko89

1 Like
  1. Hash Function is a ONE WAY functions. 1 input produce 1 unique output.
  2. Hash function in bitcoin is used in mining and transaction on blockhain
    3.Collision resistance means, impossible to product same Hash output.
1 Like
  1. A hashing function creates an encrypted code to represent an input or dataset.
  2. In Bitcoin, the SHA-256 creates a unique fingerprint for each transaction. The complexity and length of characters make for great difficulty in discovering the transaction input. This is the one way immutability property that makes BTC so valuable.
  3. Collision resistance measures the chances of two inputs creating the same output. The pigeonhole principle defines these probabilities.
1 Like

Homework on Hash Functions - Questions

  1. Describe hash functions with your own words

one way function with each unique input gives a unique output. But never output to 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 mining for new transactions on the blockchain

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

Very difficult finding two inputs that produce the same output (not impossible but infeasible)

1 Like

1.A hast function is a mathematical function that transforms any kind of input into a fixed size of output

  1. Hash functions in bitcoin or cryptocurrency are part of the hashing algorithm what is used to write new transactions.

  2. collision resistant is a hash function where it is hart to find the same input where the function creates the same output

1 Like

Hash functions are a type of function that takes an input string and releases an output that is a randomly generated code of a certain size. SHA 256 is 256 bits.

Hash functions are used in cryptocurrency like BTC by encrypting transactional information. Each transaction is hashed at each stage up the Merkle Tree until it reaches the root node, which is hashed again and copied onto the next block.

Hash functions need to be collision resistant so that it’s very unlikely that you get a matching hash output with different string inputs.

1 Like

Yes this is also a property of hash functions, but why is that useful? :smiley: sorry, I hope I don’t nag you to much :stuck_out_tongue:

2 Likes
  1. Hash function are functions which produce unique output (digital fingerprint) for each unique input, but never in reverse
    2.For transaction encryption producing hashes that are stored in the ledger.
  2. Collision resistant means that it is infeasible to find 2 inputs that would produce the same output
1 Like
  1. hash functions turn an input to an output. The output from a given input will always be the same, but it is impossible to get the input from the output

  2. To verify that the resulting hash includes the hash from all last transactions (last block, the block before that and so on) which in turn results in a unique hash that canbe verified to include the whole history of the blockchain and the latest transaction.

  3. You could theoretically get the same hash (output) from two different inputs, but in crypto use cases the probability of this are so slim that you can basically say its collission resistant, to avoid having false transaction records on the block chain

  4. If one input always results in the same output(hash), there needs to be a way to generate that output from the input. Why is it not possible to reverse-engineer this and deduce the input from the output? Maybe this was not explained well enough. It was said, its not possible, but why not?

Hash functions are functions that take an input of any length and give a unique output of a fixed length. For the sake of security there should be no way to go from output to input.

HF’s are used in cryptocurrencies as a basis of proof of work. Through the use of merkle trees, data can be easily traced back to it’s root hash. HF’s are serve as security in that if one thing is changed a radically different hash will be spit out indicating to the other nodes something is amiss and should be discarded.

Collision resistance refers to the notion that the output of two unique inputs should not be the same. Though this is theoretically possible it should take too long for this to occur due to entropy. It is referred to as resistance due to the fact that collisions are possible though not probable.

1 Like

Its the property of mathematical function that hashing is based on. The simplest example would be x - y = 1, you can’t say for sure what were the inputs used in that function. It can be 2 - 1 or 10 - 9, in fact there is infinite possibilities that would result in this function in the same output (all positive values of n + (n - 1) would give you the correct result). So there is actually no way of knowing the input to even this simple function. Same is for hash functions. :slight_smile:

2 Likes
  1. hash function produces a unique output and can not be reversed engineered.
  2. transactions in btc are the input and the unique output is delivered through the hash function.
  3. hash function is collision resistent, if it’s more or less impossible to get 2 equal results.
1 Like
  1. Hash function is a string of numerical output taken from original input either number or characters.
  2. Hash functions is part of the block hashing algorithm used to record new transaction to the existing block.
    3.Collision resistant means a hash function is collision resistant if it is hard to find two inputs that hash to the same output
1 Like

Thanks Alko. That kind of makes sense but then again leads to the next question. If inputs cannot be deducted, then how can a private key signature be verified to be legit?

  1. You can insert an input of any length of numbers, letters or symbols and that will give a unique output, or hash, of a fixed amount of numbers and letters.
  2. Each block is “signed” with a Hash which then is included in the following block
  3. Collision resistant is if it is hard to find two inputs that hash to the same output
1 Like
  1. Hash functions are special functions taking inputs and calculated them into outputs based on a pre-set formula.

  2. Has functions help validate crypto transaction to avoid corruption.

  3. If any hash functions are not collision resistant, they will be useless in crypto as we cannot accept 2 different transactions having the same hash result. This case will break the system and allow hacker to create double spending.

1 Like
  1. Hash functions is a mathematically-driven cryptographic method of taking any strings of inputs and encodes* outputs a fixed length of characters. The way to determine the input is very infeasible unless they can generate the same output by guessing the inputs.
    *‘encoding’ implies reversible function by ‘decoding’

  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).
    Bitcoin employs a hashing algorithm called SHA-256. The hash output by SHA-256 will then be used to “sign” its current block and establish a “link pointer” pointing to the next block of transactions, certifying it to be the correct immutable chain. This methodology establishes a “trust” in the tracking system by being “trustless” to any other entities except the hash that connects the longest chain.

  3. The key principle in hashing is that any transactions that occurs must be unique to itself. However, it is impossible to prevent Hash A equal to Hash B because of basic statistical probability. The more hashes a system generates, the higher the chances it will have Hash A lying on a same spot as Hash B in a “line of all possibilities”. But this can be mitigated by widening the “line of all possibilities” either by increasing the output length (32 characters vs. 64 characters), changing the base size of the character (decimals vs. hex vs. alphanumeric), or having sets of algorithms a hash function can randomly choose.

1 Like