SHA-1 - PowerPoint PPT Presentation

1 / 11
About This Presentation
Title:

SHA-1

Description:

SHA-1 Secure Hash Algorithm 1 SHA-1 Brief Introduction (NSA) (NIST) ... – PowerPoint PPT presentation

Number of Views:143
Avg rating:3.0/5.0
Slides: 12
Provided by: Xel5
Category:
Tags: sha

less

Transcript and Presenter's Notes

Title: SHA-1


1
SHA-1
  • Secure Hash Algorithm 1

2
SHA-1 Brief Introduction
  • ?????????? (NSA) ??,???????????? (NIST)
    ????????????,???1993?
  • ????? 264 ?????????? 160 ?????
  • ?? MD4 ? MD5 ???????? MIT ?? Ronald L. Rivest
    ???????????

3
SHA-1 Definitions of Bit Strings and Integers
  • Hex Digit?16??,??4-bit?string??
    7 0111, A 1010
  • ??word????32-bit?string,??4-bit?????Hex Digit
    1010 0001 0000 0011 1111 1110 0010 0011
    A103FE23.
  • ????0?232-1?????????16??,??????Hex Digit
    ????232lt Z?
  • Block 512-bit string. ????Block????16?words?????
    ?.

4
SHA-1 Operations on Words
  • AND , OR, XOR, NOT
  • The operation X Y (where 0 lt x lt 232
    and 0 lt y lt 232.)
  • The circular left shift operation Sn(X)

5
SHA-1 Message Padding
  • ???????1.
    01010000,????????? 010100001
  • 0???.
  • 01100001 01100010 01100011 01100100 01100101 (1).
  • 61626364 65800000 00000000 00000000 00000000
    00000000 00000000 00000000 00000000 00000000
    00000000 00000000 00000000 00000000.
  • ??string????232??? l 40
  • Hex?????00000000 00000028.
  • ????sequence??????M(n)??

6
SHA-1 Functions and Constants Used
  • ?SHA-1????f (0), f (1)f (79)
    ???????as a 32-bit word as output f (tB,C,D)
  • F (tB,C,D) (B AND C) OR ((NOT B) AND D) ( 0 lt
    t lt 19)
  • F (tB,C,D) B XOR C XOR D (20 lt t lt 39)
  • F (tB,C,D) (B AND C) OR (B AND D) OR (C AND D)
    (40 lt t lt 59)
  • F (tB,C,D) B XOR C XOR D (60 lt t lt 79).
  • A sequence of constant words K(0), K(1), ... ,
    K(79) is used in the SHA-1. In hex these are
    given by
  • K (t) 5A827999( 0 lt t lt 19)
  • K (t) 6ED9EBA1(20 lt t lt 39)
  • K (t) 8F1BBCDC(40 lt t lt 59)
  • K (t) CA62C1D6(60 lt t lt 79).

7
SHA-1 Computing the Message Digest
  • Before processing any blocks, the Hs are
    initialized as follows in hex,
  • H0 67452301
  • H1 EFCDAB89
  • H2 98BADCFE
  • H3 10325476
  • H4 C3D2E1F0.

8
SHA-1 Computing the Message Digest
  • MASK 0000000F. Then processing of M(i) is as
    follows
  • a. Divide M(i) into 16 words W0, ... , W15,
    where W0 is the left-most word.
  • b. Let A H0, B H1, C H2, D H3, E H4.

9
SHA-1 Computing the Message Digest
  • c. For t 0 to 79 do
  • s t AND MASK
  • if (t gt 16) W s S1 (W (s 13) AND MASK
    XOR W (s 8) AND MASK XOR W (s 2) AND
    MASK XOR W s)
  • TEMP S5 (A) f (tB,C,D) E W s K
    (t)
  • E D D C
  • C S30(B)
  • B A A TEMP
  • d. Let H0 H0 A, H1 H1 B, H2 H2 C, H3
    H3 D, H4 H4 E.

10
SHA-1 graph
11
SHA-1 code
  • (Initialize variables) a h0 0x67452301 b
    h1 0xEFCDAB89 c h2 0x98BADCFE d h3
    0x10325476 e h4 0xC3D2E1F0 (Pre-processing)
    paddedmessage (message) append 1 while
    length(paddedmessage) mod 512 ltgt 448
    paddedmessage paddedmessage append 0
    paddedmessage paddedmessage append
    (length(message) in 64-bit format) (Process the
    message in successive 512-bit chunks) while
    512-bit chunk(s) remain(s) break the current
    chunk into sixteen 32-bit words w(i), 0 lt i lt
    15 (Extend the sixteen 32-bit words into eighty
    32-bit words) for i from 16 to 79 w(i)
    (w(i-3) xor w(i-8) xor w(i-14) xor w(i-16))
    leftrotate 1 (Main loop) for i from 0 to 79
    temp (a leftrotate 5) f(b,c,d) e k w(i)
    (note all addition is mod 232) where (0 lt i
    lt 19) f(b,c,d) (b and c) or ((not b) and d),
    k 0x5A827999 (20 lt i lt 39) f(b,c,d) (b xor
    c xor d), k 0x6ED9EBA1 (40 lt i lt 59)
    f(b,c,d) (b and c) or (b and d) or (c and d), k
    0x8F1BBCDC (60 lt i lt 79) f(b,c,d) (b xor c
    xor d), k 0xCA62C1D6 e d d c c b
    leftrotate 30 b a a temp h0 h0 a h1 h1
    b h2 h2 c h3 h3 d h4 h4 e digest
    hash h0 append h1 append h2 append h3 append h4
Write a Comment
User Comments (0)
About PowerShow.com