Specifications SHA-256
SHA-256 is a cryptographic Fonction of chopping derived from SHA-1 which provides a print of 256 bits. For the history, the Cryptanalyse and other related aspects with this function, to see the article SHA-256.
Introduction
This text is adapted official document FIPS 180-2 (Secure Hash Standard) . It describes the specifications of the standard SHA-256 , whose objective is to calculate a condensed representation of electronic data (message).
When a message lower than bits passed to the algorithm implementing SHA-256, one obtains at exit one what is called chopped, or condensed of this message. The length of a digest obtained via SHA-256 is of 256 bits.
This algorithm can be cut out in two phases: the pretreatment and the calculation of the digest.
-
the pretreatment implies
- the calculation of the digest generates a table starting from the supplemented message, then transforms it via the use of functions, constants, detailed binary operations further. The unit carried out in an iterative way makes it possible to generate series of values of chopping to each turn. The final digest is the last state of these values of chopping.
The characteristics of SHA-256 are the following ones:
- size of the message: bits maximum
- size of the blocks: 512 bits
- size of the words: 32 bits
- size of the digest: 256 bits
- security level: bits (tackles birthday)
Symbols and terms used
Parameters
has, B, C,…, H = variable of work (in fact of the words of W bits), used in the calculation of chopped= the value of chopping n° I. is the initial value of chopping. is the last value of chopping.
= the word (W bits) n° J of the value of chopping n° I, where is the word of weight most extremely (on the left) of the value of chopping I.
= constant iterative according to the value of T, used in the calculation of chopping
K = many 0 additions to the message during the pretreatment (complement)
L = length of the message M, in bits
m = many bits contained in a block, is 512 bits
M = message with traiter
= block n° I (m bits), of the message M
= word (W bits) n° J, of the block (m bits) n° I, of the message M
N = many bits of shift or rotation to be applied to the word when associated with a function binaire
NR = many blocks of m bits contained in the message M after complément
T = variable temporary, word of W bits, used in the calculation of condensé
W = many bits contained in a word, is 32 bits.
= the word n° T of the table deduced from the message
Symbols
The hexadecimal notation used here will be:- example:
= binary operation OR
= binary operation XOR
= complement binaire
= addition modulo
= binary shift on the left, where is obtained by removing N bits of left of X and adding N zeros on the right.
= binary shift on the right, where is obtained by removing N bits of right-hand side of X and adding N zeros on the left.
Operations on the words
They use following conventions:
- binary operations bit bit (cf symbols)
- addition modulo , is
- the binary operation of shift on the right , where X is a word of 32 bits and , is defined by:
- the binary operation of rotation by the line , where X is a word of 32 bits and , is defined by:
Functions and constants
Functions
This section describes the functions used during the calculation of the values of chopping. SHA-256 uses 6 switching functions working on words of 32 bitsnotés X, there, Z. The result of each one of these functions is a new word of 32 bits at exit.
Constants
SHA-256 uses 64 constant values of words of 32 bits, noted . these numbers represent the first 32 bits of the decimal part of the cubic roots of the 64 first prime numbers. The following values are expressed in hexadecimal notation (16 base).
Pretreatment
This operation proceeds in three stages: to supplement the message M, to cut out the result in blocks, and to initialize the values of chopping
Complement of M
It is a question here of adding information to M so that he is of a multiple size of 512 bits.with this intention, a bit " is added; 1" at the end of the message M, then K zeros, where K is the smallest nonnegative solution of the equation: L + 1 + K = 448 MOD 512
One then adds a block of 64 bits corresponding to the binary representation of L.
Examples:
- M = " abc" , L = 8 X 3 = 24, K = 448 - (L + 1) = 448 - (24 + 1) = 423
- M unspecified such as L = 500 bits, K = 448 - (L + 1) = 448 - (500 + 1) = -53
Cutting in blocks
The supplemented message is cut out in NR blocks of 512 bits, noted . Each block of 512 bits is then cut out in 16 words of 32 bits, noted .
Initializations
The eight following variables are affected initial values as follows:
Calculation of the digest (chopped)
For this treatment one will use- a table of 64 words, noted
- eight variables noted
- eight variables containing the values of chopping, noted and initialized previously in
- two variables, noted , words of 32 bits.
One treats successively the NR blocks of M according to the following stages
For I = 1 with NR
{
- 1. One fills out table , selon
- 2. One initializes has, B, C, D, E, F, G and H with the values of chopping of the preceding turn
- 3. For T = 0 to 63
- {
- }
- {
- 4. Calculation of the intermediate values of chopping
After repetition of the four stages above for the NR blocks of the message M, (i.e., after treatment of ), the digest of 256 bits of M is obtained by concatenation of the values
External bonds
| Random links: | Government Jean-Pierre Raffarin (2) | Militares de Venezuela | Emilie Heymans | List historical reviews per year of creation | Gordon Durie | John Jairo Mosquera | Narudasia |