In Bitcoin mining, hashing refers to the computational process of turning a given input into a fixed, encrypted output. This output is known as a hash, and the input is referred to as the message.
The message is hashed using a cryptographic hash function, which is a mathematical algorithm that takes an input of any size and produces an output of a fixed size. The most commonly used cryptographic hash function in Bitcoin mining is SHA-256, which produces an output of 256 bits.
In order for a Bitcoin miner to successfully mine a block, they must produce a hash that is lower than the Target hash. The Target hash is a number that all miners are competing to find; it is automatically adjusted by the Bitcoin network so that on average, a new block is mined every 10 minutes.
If a miner produces a hash that is lower than the Target hash, they will successfully mine the block and receive a reward of 12.5 bitcoins, which is currently worth over $100,000.
The process of hashing is used in Bitcoin mining because it ensures that all miners are working on finding the next block, rather than trying to cheat the system. If one miner were to try and cheat by finding a block on their own, they would need to produce a hash that is lower than the Target hash set by the network.
However, since all miners are working together to find the next block, they will quickly realize that one miner has found a block and adjust the Target hash accordingly. This makes it impossible for one miner to cheat the system and ensures that all miners are working together to find new blocks.