Hash functions are mathematical equations that are utilized to encrypt and protect information and data. They can take any arbitrarily large piece of data and convert it to a fixed length string. Hash functions are deterministic, meaning if you input the same string it will produce the same output. They are also one-way functions making it impossible to determine the input given the output.
An everyday example that many people use are email passwords. Instead of storing the password itself, the unique hash value of the password is stored. When a password is inputted, its corresponding hash value is generated. If the generated hash value is identical to the stored hash value, the user is granted access to their email.
Cryptographic hash functions are better seen as electronic signatures for data, specifically signatures that verify cryptocurrency transactions on the public ledger. In cryptocurrency transactions, the cryptographic hash function used in Bitcoin is called SHA-256, or Secure Hash Algorithm, which generates a 32-byte hash value for each data file.
For example:
the input "hash function" outputs 04ce4af53ae1b0f46451715ffc43092eab5b23330a6584462d0723732b147c4b
while the input "hash functions" outputs 24eeecf5d50cb9c26682a3a6c1abc90fc464d38b2c6ffbb4f1b0bae253c04245
Notice that even though there was a slight modification, the SHA-256 hash value changes drastically. This is known as the avalanche effect.
When a cryptocurrency transaction is made, it must be verified by producing a SHA-256 hash value that is equal to or lower than the difficulty level. Since these hash functions are random, computers must brute force a large number of inputs before finding a "winning" value. This is an energy intensive process known as mining, which is typically performed using specialized equipment known as ASICs.
Cryptographic Hash Functions Explained by Komodo
Cryptographic Hashing by Shaan Ray
If there is anything you'd like to add or change, you can tweet your feedback at @messari_crypto or email jack@messari.io