Understanding Bitcoin is a one-way hash function should make sense because a hash function cannot be reversed. Once you understand that, it is hard to go back to thinking otherwise. The secure hash algorithm or SHA-256 puts Bitcoin in a different lane, where you can share your bitcoin address without risking the security of your funds. But there is so much more.
A one-way hash function is a mathematical function that generates a fingerprint of the input, but there is no way to generate the original information twice. The genius around a secure hash function is a topic I will touch on, but Bitcoin and the whole inception behind it are akin to scrambling an egg. It is a one-way function; once the egg is cracked, the yolk cannot be placed back into the egg and sealed. Once the yolk is cooked on a hot skillet, the egg scramble cannot be turned back into the yolk. The Bitcoin algorithm is no different. The core code is essentially set in stone in cyberspace and still functions without an administrator at the helm of its creation.
In the past, the process of trade and money was complicated and bequeathed with ethical dilemmas. Africans saw cowrie shells and glass beads as revered money, so Europeans flooded the market with these beads. The implications were vast. The increase of counterfeit beads debased the value, which made it easier to manipulate for trade. The Romans clipped bits from the existing coins in circulation and then used the leftover clippings to mint new coins.
The coins kept getting smaller. Yet, the empire kept expanding. Prices went up while the purchasing power of the currency went down. Which ultimately, over time, collapsed the Roman economic system. America is doing the same on a grander scale by expanding the money supply via the money printer, although not having the dollar pegged to a gold-backed currency after the Nixon shock. It encourages an ever-increasing weak currency where printing worthless paper notes are just as damaging.
The first Age of Enlightenment arose as a result of the separation of church and state. The second Age of Enlightenment will emerge as a result of the separation of money and state. History has shown that any monetary currency clipped, removed, manipulated, or altered will always be exploited by human hands. Bitcoin removes these motives that have corrupted emperors, politicians, investors, and bankers alike, facilitating the road to serfdom. The hash function of SHA-256 and RIPEMD-160 aids in completely removing levels of exposure and seizure through public and private keys.
RIPEMD-160
Each part of the hash function plays a vital role, from managing Bitcoin addresses to bolstering the proof-of-work process. The RIPEMD-160, which is short for RACE Integrity Primitives Evaluation Message Digest, is used to help turn public keys into bitcoin addresses. There are five Ripe Message-Digest functions, but 160 is used in the Bitcoin network because it is highly secure and functional. RIPEMD-160 is used in the Bitcoin standard, which creates an alternative to lengthy public addresses. It is a more robust version of the RIPEMD-128 algorithm, which produces a 128-bit output. The process of hash function construction is challenging, especially given that it must accept strings of arbitrary length as input.
How this all works under the hood is a 65-bit private key is formulated, which generates an uncompressed public key. This public key is essentially your Bitcoin address, but it is a long series of digits after its initial inception. Padding is implemented to strengthen and prevent length extension attacks. For ease of use, the key is shortened or compressed with RIPEMD-160 down to 20 bits. This is where a compressed function comes into play. The protocol uses a checksum to check for mistakes via SHA-256, which hashes twice to validate the address is secure and correct.
Using RIPEMD-160 when creating Bitcoin addresses reduces the address space. This means that instead of having to type in very long addresses, they are reduced to a more manageable length. This process is a one-way function. Each public and private key is mathematical unique and cannot be duplicated, only shortened and compressed.
“SHA-256 is not going to be broken by Moore’s law computational improvements in our lifetimes. If it’s going to get broken, it’ll be by some breakthrough cracking method.” -Satoshi Nakamoto
SHA-256
Bitcoin uses the SHA-256 hash function in its proof-of-work process. Proof-of-work is considered the original cryptocurrency consensus mechanism. Bitcoin is the original and best example of that mechanism. At one point, difficulty adjustment was so low that mining could be achieved on computers with low hash power, such as a home computer. Over time, as the demand for more mined Bitcoin increased, the difficulty adjustment to earn one increased.
The difficulty to acquire Bitcoin has gone beyond what home computing power can accomplish. Mining computing hardware equipped with ASIC chips is the best choice to mine bitcoin. Currently, there is a lot of competition for hash rate, making it almost unprofitable to mine unless you have a high-end mining rig being fed off of cheap renewable energy. In comparison, if you are considering getting into mining bitcoin, do not forget you will be in competition with high-end major mining companies like Final Hash, Marathon Digital, and Riot Blockchain, Inc.
The cool part about SHA-256 is security and the ability to encrypt sensitive blockchain information that otherwise could be used to the detriment of the user. This security is immutable and runs on a consistent schedule. Secure hash algorithms help compile and sort out astronomical math equations to earn bitcoin by mining computers. The human intervention of the process is not needed and would be downright impossible to achieve even with the best calculators money could buy. A private key is a 256-bit number. A “bit” has a value of 0 or 1 and is the smallest unit of measurement for computer data.
Digital signatures are secured with private keys, meaning you can transact with Bitcoin monetarily under that key’s unique bit number. If you don’t have the correct private key, you cannot spend the bitcoin or gain access to any funds under the keys blockchain database. Therefore, these private keys must be correctly generated, then stored in a safe and secure location. Remember the saying coined by Isaiah Jackson, “No keys, No cheese.”
The possibility data is revealed from the hash value is so low it is considered impossible. The combinations of digits and data remove brute force attacks or hijacking of the network due to sheer complexity. In addition, it’s also severely unlikely that two data values (known as collision) have the same hash. After reading this essay, learning about hash functions when in doubt about Bitcoin’s security and possible exposure with corrupted public or private keys should be a breeze.
Those feelings of doubt should be quelled once you understand how well thought out and secure the encryption process is thanks to the genius of Satoshi. The Bitcoin network is designed to take money out of the hands of centralized control and into a permissionless decentralized world. The hash functions SHA-256 and RIPEMD-160 make this possible, in a functional one-way and secure fashion.
This is a guest post by Dawdu Amantanah. Opinions expressed are entirely their own and do not necessarily reflect those of BTC Inc or Bitcoin Magazine.
Source: https://bitcoinmagazine.com/technical/bitcoin-is-a-one-way-hash-function