Hash functions are an ingenious tool that are a fundamental part of public key cryptography. And by extension of the Blockchain technology. They are also called “one-way functions“.
In computer science, a one-way function is a function that is easy to compute on every input, but hard to invert given the image of a random input. Here, “easy” and “hard” are to be understood in the sense of computational complexity theory, specifically the theory of polynomial time problems.
For example, it is possible to multiply 2543 and 7543 even with paper and pencil. But it is much more complicated the reverse process: given a certain large number to find the two numbers that must be multiplied to give that product. Even more so if those numbers have certain restrictions. When these numbers are massive it is so complicated that powerful computers are needed.
Blockchains are an unexpected result of cryptography. Information is ‘crunched’ my mathematical algorithms and converted into hashes with one-way functions. Any information alteration changes the hashes and fires the alarm.