SHA-256 processes input data using rounds, which are a series of mathematical operations. Each round includes steps such as preprocessing the data, message expanding, and message compressing. The SHA-256 algorithm is primarily composed of the following steps:
Preparation of data:
After adding one bit, the length of the message is multiplied by 512.Message Expansion:
The 512-bit input is divided into 16 words of 32 bits using a series of logical operations. The words are expanded to 64 32-bits words.Message Compression:
After the expansion of the message block, it is divided into 64 rounds. Each round consists of:Find the round constant:
Each round generates a 32-bit constant depending on the position of the round in the order.When to send messages:
A 64-entry schedule is created based on the rounding constant, the message block of 64 words and the message block.Updating Working variables:
To update the eight 32-bit working variables that are used as intermediate values in the hashing procedure, a series of logical calculations and the message schedule is used.Calculate the hash value:
The 256-bit value is created by adding the results of all 64 working values.