Homework on Hash Functions - Questions
- Describe hash functions with your own words.
Hash functions are a one way function where each transaction creates a digital fingerprint via a unique input that gives a unique output. You can go from an input to an output, but never from an output to an input.
- 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).
Letās start off by saying that Bitcoin wouldnāt be Bitcoin today without hashing algorithms. BTC uses SHA256 because it is more secure than the old MD5, because people figured out how go from Output to Input on MD5. SHA256 uses hexadecimal Base 16 instead of the MD5 Base 10. One way hashing is essential to BTC as it provides essential security for information in the input. Such usage ensures that it is not possible to generate the input even if the output is known. SHA256 is used because of itās unique hashing value, high hashing speed and secure hash function that is almost computationally infeasible to reverse the function and make it two-way.
- 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).
When hashing from two different inputs A & B to two different outputs H(A) and H(B) you do not want the outputs to ever be the same H(A) and H(B). You want H(A) ā H(B). You do not want H(A) = H(B). This would cause a collision. Collisions are more likely to occur with MD5 or SHA1 for example, where there have been identical false hashes produced. It is highly unlikely for a collision to occur with SHA256. Not impossible but highly unlikely as the odds would be astronomical if it were to occur.