SHA256
Last updated
Last updated
SHA stands for "secure hashing algorithm". The SHA-1 set of hash functions was developed by the NSA and published in 1993 – with its more well-known improved version being published in 1995 – as an extension to the MD5 hash function. From 1995 to 2005, SHA-1 was considered an ideal hash function; complete with all 3 properties of ideal hash functions: preimage resistance, second preimage resistance, and collision resistance.
However, as computer processors became more powerful, SHA-1 became collision prone. In 2005, it was shown it’s possible to muster the necessary computing power to find a collision for a SHA-1 hash value and swap the input values for its 160bit long output value. As a result, SHA-1 is now considered insecure. It was formally depreciated by the United States' National Institute of Standards and Technology (NIST) in 2011 disallowing its use for digital signatures. In 2020, a collision attack on a SHA-1 hash to produce the same SHA-1 hash value for any two arbitrary inputs was carried out for less than $100,000 USD.
Before SHA-1 became officially insecure, the NSA produced a second set of more complex hash functions, first published by NIST in 2001, called the SHA-2, or Secure Hashing Algorithm 2, set of hash functions (SHA224, SHA256, SHA384, SHA512, SHA512/224, and SHA512/256). Like SHA-1, the SHA-2 family of hash functions are Merkle-Damgård hash functions; however, their compression functions are more complex, and the message digests are significantly larger than SHA-1.
Named after its message digest bit-length, SHA-256 produces a 256-bit message digest. This means SHA-256 has possible unique output values. Human beings aren't good at intuitively understanding astronomically large numbers, so to put it into perspective, 1 million seconds equates to about 11 days, 1 billion seconds equates to about 31.6 years, 1 trillion seconds or a 1 with 12 zeros, equates to about 31,710 years, and is approximately equal to or 1 with 77 zeros following it; meaning it's safe to say SHA-256 has such a low probability of two different input values sharing the same message digest, or very good collision resistance, that it will likely be quite a long time before we have the ability to find a feasible SHA-256 collision attack. Additionally, since BSV publishes all transactions in clear text, i.e., it’s not a cryptographic system, and each transaction uses unique values, even if an attacker were able to discover a private key for a particular transaction, they would have only gained access to a single UTXO within a single transaction.
Using the hash calculator, generate a SHA-256 message digest in hexadecimal (HEX) for each of the following ASCII input strings:
In Bitcoin, the double hash of SHA-256 is commonly written as SHA-256d or abstracted to a new function called HASH-256.
HASH-256 is used to:
Generate transaction IDs – including Merkle Roots
Generate block header IDs
Block header IDs are used to find a proof-of-work solution
Using the hash calculator, generate a SHA-256 message digest in hexadecimal (HEX) for each of the following ASCII input strings: