One of the building blocks of blockchain technologies are cryptographic hash functions. This tool demonstrates the calculation of the SHA-256 hash function for linking blocks, integrity checking or higher level existence proof and notarization applications.
A hash function summarizes an arbitrary length message into a fixed-length message digest or hash value as in hash(message) = hash_value. Using SHA-256 as a hash function, any message entered below – e.g. data of a document, contract, image, certificate or any arbitrary data – is summarized by a 256 bit value.
The resulting hash value is usually represented as hexadecial characters (up to 64 characters). For demonstration purposes, a decimal representation (up to 78 places) and binary digits (up to 256 digits) are shown additionally.
Properties of cryptographic hash functions for blockchains
As a cryptographic hash function, SHA-256 is suitable for blockchain applications to secure the integrity of data in blocks, to link a block to its predecessor and to realize higher level applications such as existence proofs. Blockchains require cryptographic hash functions, as they are one-way functions with the properties of collision resistence and preimage resistence. While it is efficient to compute the function hash(message) = hash_value, it is not efficient to reverse it by computing a message from hash_value. Since the length of message can be larger than the length of hash_value (given the same encoding), collisions exist, i.e. pairs of two message inputs with the same resulting hash_value output – however, it is not efficient to find such a pair of messages (collision resistence). More specifically, it is not efficient to find any message for a given hash_value (preimage resistence) and it is not efficient to derive a message’ from an existing message such that both messages result in the same hash value (preimage resistence 2nd). In effect, the output of a cryptographic hash function changes unpredictably in a pseudo-random fashion when the input changes.