
A hash is a unique string of characters resulting from applying a special hash function to specific input data. The process of hashing is the conversion of arbitrary data into a set of fixed-length characters, which creates a unique "signature" for this data. There are many systems for encoding information, and one of them is the SHA-256 algorithm. This is a hashing algorithm that is used in Bitcoin to ensure the integrity of the information stored in a block.
The hash algorithm only works in one direction: this means that from any content we can generate a hash of it (its "digital fingerprint"), but from a hash it is impossible to generate the content associated with it except by randomly trying until we find it. Let's find a secure hashing algorithm used for encryption, the size of the output data is 256 bits. Hash algorithms create unique, irreversibly encoded hashes, a cryptographic hash function developed by the US National Security Agency (NSA) and the National Institute of Standards and Technology (NIST). SHA (Secure Hash Algorithms) is a family of cryptographic hash functions that can accept messages of arbitrary length and compute a unique hash code of a fixed length. The SHA hash code can be used to verify the integrity of a message, as well as to generate a digital signature for the message. The term SHA stands for “Secure Hash Calculation”. This method of mathematical calculation protects cryptographic information sets. After all, in order to receive encoded data, it is necessary to apply a special code that is known only to the holder.
In 1993, the first SHA protocol, colloquially called SHA-0, appeared. Two years later, a stronger and improved version was released - SHA-1. A few years later, SHA-2 was launched, which has four variants in terms of the number of bits: SHA-224, SHA-256, SHA-384 and SHA-512.

The security of a hash function can be ensured by the complexity of a certain mathematical problem, provided there is evidence that attacks aimed at violating the requirements for it are as difficult as the solution to this problem.
SHA-256 is one of the most used due to the balance between security and computational cost of generation, since with high collision resistance this algorithm is very efficient, the length of the resulting hash is always the same, regardless of the length of the content used to generate the hash: be it one a letter or all the words of the entire book - the result will always be a string of 64 letters and numbers (256 bit encoding, 32 bytes).
In a blockchain network, all nodes have a copy of a 64-character hash, which is information that represents, for example, an entire block. Once this information has been verified by the network (or, equivalently, already registered on the chain), any manipulation of it that attempts to change any symbol of the verified hash will be immediately detected and discarded.
Transactions of the Bitcoin payment system, which are represented as a certain array of data, are combined into blocks (blockchain) and go through a hashing algorithm, that is, the data of their fields is fed into the input of a cryptographic hash function. Each transaction indicates where funds are debited from and where they are sent. To indicate the addressee, its public key (a unique identifier in the Bitcoin network) is used. In order for the recipient to use the money received within the Bitcoin protocol, he must create a new transaction that will take the currency from the previous one and redirect it to another address using the public key. Accordingly, the new transaction, together with the transactions of other users of the Bitcoin network, will be included in a new block. Thus, the number of blocks in the blockchain increases. However, every transaction must be approved - the system must reach a consensus. There are several ways to do this, but Bitcoin uses the Proof-of-Work (PoW) principle. Once the transaction is accepted, it is considered real and the cryptocurrency moves from one wallet to another.