Homework on Hash Functions
- Describe hash functions with your own words
Hash functions are one way functions where each unique input will give you a unique output (Fingerprint). This means that even if a really small part of a huge file is changed, then the fingerprint will be totally different therefore preventing fraud and providing a high level of security.
- 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 at its core is a digital ledger of hashes that use proof of work in combination with the SHA-256 algorithm to mathematically prove traceability and unbreakability of the system.
This process is what we call mining. Miners need to hash the block header so that it is always equal or less than the ātarget hashā, that is when they add their mined block to the blockchain.
Miners apply the SHA-256 hash function to the block header but in order to obtain the acceptable hash they must try with the ānonceā repeatedly and incrementally.
The whole process is very complex and requires miners to repeat the mathematical guessing various times at a fast pace, which implies the need sophisticated hardware in a energy intensive process.
- 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 we say that hash functions need to be collision resistant, we mean that it is extremely hard (not impossible) to find two inputs which would hash the same output. The harder it is to find those two inputs, the more secure we can consider the hash function.