Federal Information
Processing Standards Publication 180-2
2002 August 1
Specifications for the
SECURE HASH STANDARD
Table Of Contents
1. INTRODUCTION..............................................................................................................................................................3
2. DEFINITIONS.....................................................................................................................................................................4
2.1 GLOSSARY OF TERMS AND ACRONYMS....................................................................................................................4
2.2 ALGORITHM PARAMETERS, SYMBOLS, AND TERMS...............................................................................................4
2.2.1 Parameters........................................................................................................................................................4
2.2.2 Symbols..............................................................................................................................................................5
3. NOTATION AND CONVENTIONS.............................................................................................................................6
3.1 BIT STRINGS AND INTEGERS.......................................................................................................................................6
3.2 OPERATIONS ON WORDS.............................................................................................................................................7
4. FUNCTIONS AND CONSTANTS.................................................................................................................................9
4.1 FUNCTIONS....................................................................................................................................................................9
4.1.1 SHA-1 Functions..............................................................................................................................................9
4.1.2 SHA-256 Functions.........................................................................................................................................9
4.1.3 SHA-384 and SHA-512 Functions................................................................................................................9
4.2 CONSTANTS.................................................................................................................................................................10
4.2.1 SHA-1 Constants............................................................................................................................................10
4.2.2 SHA-256 Constants.......................................................................................................................................10
4.2.3 SHA-384 and SHA-512 Constants..............................................................................................................10
5. PREPROCESSING..........................................................................................................................................................12
5.1 PADDING THE MESSAGE ............................................................................................................................................12
5.1.1 SHA-1 and SHA-256......................................................................................................................................12
5.1.2 SHA-384 and SHA-512.................................................................................................................................12
5.2 PARSING THE PADDED MESSAGE .............................................................................................................................13
5.2.1 SHA-1 and SHA-256......................................................................................................................................13
5.2.2 SHA-384 and SHA-512.................................................................................................................................13
5.3 SETTING THE INITIAL HASH VALUE (H
(0)
)..............................................................................................................13
5.3.1 SHA-1...............................................................................................................................................................13
5.3.2 SHA-256..........................................................................................................................................................13
5.3.3 SHA-384..........................................................................................................................................................14
5.3.4 SHA-512..........................................................................................................................................................14
6. SECURE HASH ALGORITHMS ................................................................................................................................15
6.1 SHA-1..........................................................................................................................................................................15
6.1.1 SHA-1 Preprocessing....................................................................................................................................15
6.1.2 SHA-1 Hash Computation............................................................................................................................15
6.1.3 Alternate Method for Computing a SHA-1 Message Digest...................................................................17