Title: SHA1 Secure Hash Algorithm
1SHA-1 Secure Hash Algorithm
2????
- ???????? SHA-1 ????? ?????? 1995 ?"? ?????
???????? ????????? ?????????? (NIST) - ????????? ??? ????? ?? ???????? ???? SHA ??????
???? 1994. - ????????? ??????? ?????? ???? SHA-256 ???????? ??
?????? ??? ?????????.
3????
- ????????? ???? ?? ????? / ?????? ????? ???? ????
?- 264 ???. - ????????? ???? "?????" (digest) ?? ?????? ?????
160 ???. - ????????? ??? "?? ??????" ????? ?? ???? ????? ??
?????? ??????? ?"? ??????. - ??? ?????? (??? ?????? ?? ?????? ???? ????? ????)
?????? ?????? ????? ????????.
4????? SHA-1
- ????? ????? ???? ???????
- ????? ???? ?????
- ????? ????? ?????
5??????? ?- SHA-1
- ????? ??????? ???????
- ???? ????????
- ?????? ????? ?????????
- ???? ?????
- ????? ???? ???????
6????? ?????? ????? ???????? ?????? ?? DSA
- ?"? ????? ?????? ?????? ???? ???? ????? ?????
????????. - ?????? ???? ?????? ????? ?- 264 ????? ????.
?????
???????? SHA-1
????? ??????
DSA sign
???? ????
????? ????????
7????? ?????? ????? ???????? ?????? ?? DSA
- ?"? ????? ?????????, ?????? ??????? ?????????
??????? ???? ????? ????????.
????? ???????
???????? SHA-1
????? ??????
????? ????????
???? ??????
DSA verify
True / False
8????? ???? ?? ?????????
- ?? ???? ????? ????? ?"?????" ????.
- ?? ???? ????? ????? ?? ???? ?????? ??????? ?????
????? ?????? ?? ???? ???? ?? ????? ?? ????? ????
???? ?????.
9?????? ???????
- ?? Hex ??? ?? ?????? 0,1,2,3,4,5,6,7,8,9,A,B,C,D,
E,F ?????? ?"? ?????? ?? 4 ?????. - Word ?????? ?? 32 ?????. ???? ?"? 8 ??? Hex ??
????? ???????. - ?????? ????? ????? 0-232-1 ?????? ?"? Word.
10?????? ??????? - ????
- ?????? ????? ????? 232-264 ?????? ?"? ??? ????
(A,B) ???? A,B ?? ????? (Words). A ????? ?? 32
?????? ???????? ?? ????? ?- B ????? ?? 32 ??????
???????? ?? ????? (????? ?????). - Block ?????? ?? 512 ?????. ????? ?"? 512 ?????
(???????) ?? ?"? 16 ????? (Words) ????? ??? Hex.
11????? ?????? ?? Words
12????? ?????? ?? Words - ????
13????? ?????? ?? Words - ????
n ???, 0ltnlt32.
14????? ????? ????? ??? ?????
- ???? ?? ????? ?????? ?"? X Y ???? X,Y ?????
????? 0-232-1. - Z(X Y) mod 232
- ?????? ???? ??? ????? 0-232-1.
15????? ????? Circular left shift
- ???? ?? ?????? ?"? Sn(X) ???? n ???, 0ltnlt32, X
??? Word. - Sn(X) (Xltltn) v (Xgtgt32-n)
- ?????? ???? ??? ????? 0-232-1.
16????? ???????? SHA-1
17Padding ????
- ?????? ?????? ?? ?????? ?? ?????? ???? ?????
????? ?? 512 ?????, ????? ?????? ??????? ?????
????? ?? n ??????. - ???????? 1 ???? ????? ??????? ?? 512 ???? ??????
?"? ?????? ?? ???? Hex. - ???????? 2 ????? ?????? ??????? ?? 512 ???.
18????? Padding
- ????? L ???? ?????? ??????.
- ????? "1" ???? ?????? (??? ????).
- ????? 512-(L mod 512) -1-64 ????? ??????.
- ????? ???? ?? L ????? ????? ?"? 2 Words ????
?????? (?? ?? ?????? ????? ????? ???? ???).
19????? ?????? Padding
??????
??? III - ????? 512-40-1-64407
20????? ?????? Padding - ????
???? ??? III ?????? ??????
????? ?? L40 (????? ?"? 64 ???) ???? ??????
21????? ?????? Padding - ????
???? ??? IV, ?????? ????? Hex ?????? ??????
- ??? ???? ??? ?????? ?- Mi.
- ???? ????? ?- 16 Words (??"? 512 ???).
- ???? Padding ?????? ????? ????? ??? ?? ????.
22????? ???????? ?????? ?????????
- ??????? 80 ???????? (???????? 0-79).
- ??????? ????? ?? 3 ????? ??????? ???? ???.
- ????????? ??????? ?-4 ??????
- ft(X,Y,Z) (X Y) v (X Z) 0?t?19
- ft(X,Y,Z) X xor Y xor Z 20?t?39
- ft(X,Y,Z) (X Y) v (X Z) v (Y Z) 40?t?59
- ft(X,Y,Z) X xor Y xor Z
60?t?79
23????? ?????? ?????? ?????????
- ??????? 80 ?????? (???????? 0-79).
- ?? ???? ??? ????? ???? ???.
- ??"? 4 ?????? ?????
- Kt 5A827999 0?t?19
- Kt 6ED9EBA1 20?t?39
- Kt 8F1BBCDC 40?t?59
- Kt CA62C1D6 60?t?79
24????? ?????? ?????? ?????????
- 5 ?????? ??? ??? ??? ????? ???? ???, ???????
A,B,C,D,E. - 5 ?????? ??? ??? ??? ????? ???? ???, ???????
H0,H1,H2,H3,H4. - 80 ?????? ??? ??? ??? ????? ???? ???, ???????
W0,W1,,W79. - ????? ??? ????? ???? ????? TEMP.
25????? ??????
- H0 67452301
- H1 EFCDAB89
- H2 98BADCFE
- H3 10325476
- H4 C3D2E1F0
26????? ????? ?????? - ????
- ?? ?? ???? ?????? ???? ????? Padding ??????? 80
?????. - ?? ???? ????? Mi ?????? ???? 16 ?????.
- ????????? ?????? ????? ?????? ????? ?? ?? ???? Mi
????? (?????? ?????????).
27???????? ?' ?????? ????? ??????
For each Mi do Divide Mi into 16 words
W0,W1,,W15 For t16 to 79 do
WtS1(Wt-3 xor Wt-8 xor Wt-14 xor Wt-16)
AH0 BH1 CH2 DH3 EH4 For t0 to 79
do TEMPS5(A)ft(B,C,D)EWtKt ED DC
CS30(B) BA ATEMP H0H0A H1H1B
H2H2C H3H3D H4H4E
28???????? ?' ?????? ????? ??????
For each Mi do Divide Mi into 16 words
W0,W1,,W15 AH0 BH1 CH2 DH3
EH4 For t0 to 79 do stMASK if
t?16 then WsS1(W(s13)MASK xor W(s8)MASK xor
W(s2)MASK xor Ws) TEMP S5(A)
ft(B,C,D) E Ws Kt ED DC CS30(B)
BA ATEMP H0H0A H1H1B H2H2C
H3H3D H4H4E
29????? ??????
- ???? ????? ??? ??????????? ????? ????? ?? ??????
????? 160 ??? ??????? H0,H1,H2,H3,H4 ???? ???. - ??? ???? ?????? ??? ???????? ?' ????????? ?'.
30?????? ??? ???????????
???????? ?'
???????? ?'
- ????? ?- 28 ?????? ????? Word.
- ????? 36,485 ?????? ???????? ?? ?????.
- ????? ?- 91 ?????? ????? Word.
- ????? 821 ?????? ???????? ?? ?????.
????? ????? ????????? ?' ?? ????? ???????
??? ????? ????????? ?? ???? ???????.
31????? ?????? ????? ?????
- ???? ?? ?? ?????? ?? ?????? abc
- abc01100001 01100010 01100011
- abc616263 (Hex)
- L24
- ???? ????? Padding ????
32????? ?????? ????? ????? - ????
- ???? ?? W16-W79
- ?? ??????? ?? ?????? ????????? ?' ????? ?????
??????? A,B,C,D,E ?????? ?????
33????? ?????? ????? ????? - ????
34????? ?????? ????? ????? - ????
35????? ?????? ????? ????? - ????
36????? ?????? ????? ????? - ????
37????? ?????? ????? ????? - ????
38????? ?????? ????? ????? - ????
- ??? ???? ?? Hi
- H067452301 42541B35 A9993E36
- H1EFCDAB89 5738D5E1 4706816A
- H298BADCFE 21834873 BA3E2571
- H310325476 681E6DF6 7850C26C
- H4C3D2E1F0 D8FDF6AD 9CD0D89D
?????? ??????
A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D