Secure Hash Algorithm (SHA-1)
SHA is developed by NIST, specified in the Secure Hash Standard (SHS, FIPS Pub
180), 1993. SHA-1 is specified as the hash algorithm in the Digital Signature Standard
(DSS), NIST.
Generic Logic
Input message must be < 264 bits
Output: 160 bit message digest
Message processed in 512-bit blocks sequentially
SHA design is similar to MD5, but a lot stronger
Basic Steps
Step 1: Padding bits:
• A b-bit message M is padded in the following manner:
• Add a single “1” to the end of M
• Then pad message with “0’s” until the length of message is congruent to 448, modulo
512 (which means pad with 0’s until message is 64-bits less than some multiple of 512).
Step 2: Appending length as 64 bit unsigned
• A 64-bit representation of b is appended to the result of Step 1.
• The resulting message is a multiple of 512 bits
• e.g. suppose message original length b = 900
Then 2 x 512 = 1024 bits
Step 3: Buffer initiation:
Initialize message digest (MD) to these five 32-bit words
A = 67452301
B = efcdab89
C = 98badcfe
D = 10325476
E = c3d2e1f0
Step 4: Processing of the message (the algorithm)
• Divide message M into 512-bit blocks, M0, M1, … Mj, …
• Process each Mj sequentially, one after the other
• Input: • Wt : a 32-bit word from the message
• Kt : a constant
• A, B, C, D, E : current MD •
Output: • A, B, C, D, E: new MD
• At the beginning of processing each Mj
the 80-step processing of512-bit consists blocks of 4 rounds, 20 steps each
Each step t (0 <= t <= 79):
Input:
Wt – 32-bit word from the message
Kt – constant
ABCDE: current MD
Output:
ABCDE: new MD
Only 4 per-round distinctive additive constants:
• 0 <= t <= 19, Kt = 5A827999
• 20<=t<=39, Kt = 6ED9EBA1
• 40<=t<=59, Kt = 8F1BBCDC
• 60<=t<=79, Kt = CA62C1D6
Basic Logic Functions
When all Mj have been processed, the 160-bit hash of M is available in A, B, C D and E.
__________________________________________________________________________
References:
1. Oded Goldrich, Foundations of Cryptography-Applications, vol-2, Cambridge Univ. Press, 2005.
2. Behrouz A Forouzan, Debdeep Mukhopadhyay, Cryptography and Network Security- Mc-GrawHill,
2015. 5. William Stallings, Cryptography and Network Security, Pearson Education, 2013.
3. https://www.slideserve.com/delila/ece-111
4. http://www.programmersought.com/article/50036477/
5. https://www.youtube.com/watch?v=sDpR2XPLcAE
6. https://www.ics.uci.edu/~keldefra/teaching/fall2016/uci_compsci134/slides/LEC5-KED.pdf