The SHA-256 is a hash algorithm (Secure Hash Algorithm) that converts data into a hash with a length of 256 bits.
Hash algorithms are used in Blockchain technology to represent the blocks and to protect the Blockchain from manipulation. If only a small amount of the information changes, the entire hash changes. A hash function has the property that it is easy to calculate in one direction but can only be solved backwards by generating random number combinations [1].
The SHA-256 is used for example with Bitcoin. The actual hash is 256 bits long and is usually displayed in 64 characters in hexadecimal form. In the Bitcoin example, if a hash value is to be created for a new block, the bundled information about the transactions is first converted into a hash using a secure hash algorithm. This is the Merkle Root. The Merkle Root is encrypted together with the hash of the previous block and the nonce to the hash value of the block header.
Since the nonce is unknown, SHA-256 fulfills also another function. In order that the miner can create the block, he has to solve the proof of work mechanism. This is a competition between the miners to find out the nonce. Whoever finds out a valid nonce first can create the block [2].
[1] Heines, R. (2017): Blockchain Technology Applications: A Conceptual Framework from a Supply Chain Perspective
[2] Antonopoulos,A. (2015): Mastering Bitcoin Unlocking Digital Cryptocurrencies