$ od -c -N 50000 [_CDCSL_93-16_]<1>Cedar>release>SHS>OneM.c
0000000 / * \n * C o p y r i g h t
0000020 323 1 9 9 2 b y X e r o x
0000040 C o r p o r a t i o n . A
0000060 l l r i g h t s r e s e r v
0000100 e d . \n * C a r l H a u s
0000120 e r , F e b r u a r y 7 ,
0000140 1 9 9 2 \n * A s t r a i g
0000160 h t f o r w a r d i m p l e m
0000200 e n t a t i o n o f t h e
0000220 i n n e r 1 6 - w o r d c o
0000240 m p u t a t i o n \n * o f
0000260 t h e p r o p o s e d S e c
0000300 u r e H a s h S t a n d a r
0000320 d ( S H S ) , d a t e d 2
0000340 2 J a n u a r y 1 9 9 2 \n
0000360 * T h i s f u n c t i o n
0000400 i s a p p l i e d t o s u
0000420 c c e s s i v e 1 6 w o r d
0000440 b l o c k s o f t h e f
0000460 i n a l \n * p a d d e d m
0000500 e s s a g e . ( T h e p a
0000520 d d i n g h a s t o b e
0000540 d o n e s e p a r a t e l y -
0000560 - s e e s e c t i o n 4 \n
0000600 * o f t h e S H S s t
0000620 a n d a r d ) \n * \n * T o
0000640 u s e : i n i t i a l i z e
0000660 a f i v e w o r d a r r
0000700 a y , h , t o \n * { 0
0000720 x 6 7 4 5 2 3 0 1 , 0 x 0 e f
0000740 c d a b 8 9 , 0 x 9 8 b a d c
0000760 f e , 0 x 1 0 3 2 5 4 7 6 ,
0001000 0 x 0 c 3 d 2 e 1 f 0 } \n *
0001020 a n d t h e n p a s s h
0001040 a n d p o i n t e r s t o
0001060 s u c c e s s i v e 1 6 w
0001100 o r d m e s s a g e b l o c
0001120 k s \n * t o p a r a m e
0001140 t e r s h a n d m o f
0001160 o n e m . \n * T h e f
0001200 i v e w o r d h a s h i s
0001220 t h e c o n t e n t s o f
0001240 h a f t e r t h e l a s
0001260 t b l o c k \n * h a s
0001300 b e e n p r o c e s s e d .
0001320 \n * / \n \n # d e f i n e S 5
0001340 ( x ) ( ( ( x ) < < 5 ) |
0001360 ( ( x ) > > 2 7 ) ) \n # d e f i
0001400 n e S 3 0 ( x ) ( ( ( x ) <
0001420 < 3 0 ) | ( ( x ) > > 2 ) )
0001440 \n # d e f i n e K 0 0 x 5 a
0001460 8 2 7 9 9 9 \n # d e f i n e K
0001500 1 0 x 6 e d 9 e b a 1 \n # d e
0001520 f i n e K 2 0 x 8 f 1 b b c
0001540 d c \n # d e f i n e K 3 0 x
0001560 0 c a 6 2 c 1 d 6 \n # d e f i n
0001600 e A N D ( x , y ) ( ( x ) &
0001620 ( y ) ) \n # d e f i n e F 0 (
0001640 x , y , z ) ( A N D ( x , y )
0001660 | A N D ( ~ ( x ) , z ) ) \n
0001700 # d e f i n e F 1 ( x , y , z
0001720 ) ( ( x ) ^ ( y ) ^ ( z ) ) \n
0001740 # d e f i n e F 2 ( x , y , z
0001760 ) ( A N D ( x , y ) | A N
0002000 D ( x , z ) | A N D ( y , z
0002020 ) ) \n # d e f i n e w o r d
0002040 u n s i g n e d l o n g \n s t
0002060 a t i c r e v e r s e b y t e
0002100 s ( w ) \n w o r d * w ; \n { \n
0002120 c h a r * p = ( c
0002140 h a r * ) w ; \n c h
0002160 a r t ; \n t = * p
0002200 ; \n * p = * ( p + 3
0002220 ) ; \n * ( p + 3 ) =
0002240 t ; \n t = * ( p + 1
0002260 ) ; \n * ( p + 1 ) =
0002300 * ( p + 2 ) ; \n * ( p +
0002320 2 ) = t ; \n } \n \n v o i d
0002340 o n e m ( m , h ) \n w o r d
0002360 m [ 1 6 ] ; \n w o r d h [ 5 ]
0002400 ; \n { \n w o r d w [ 8
0002420 0 ] ; \n i n t t ; \n
0002440 w o r d A , B , C ,
0002460 D , E ; \n w o r d
0002500 * p , * q ; \n w o r d
0002520 * p m 3 , * p m 8 , * p m
0002540 1 4 , * p m 1 6 ; \n w
0002560 o r d t e m p ; \n i n
0002600 t i ; \n # i f d e f L I T T
0002620 L E _ E N D I A N \n f o
0002640 r ( i = 0 ; i < 1 6 ; i +
0002660 + ) { \n r e v e
0002700 r s e b y t e s ( & ( m [ i ) )
0002720 ; \n } ; \n # e n d i f \n
0002740 A = h [ 0 ] ; B =
0002760 h [ 1 ] ; C = h [ 2 ] ; D =
0003000 h [ 3 ] ; E = h [ 4 ] ; \n
0003020 f o r ( p = m , q =
0003040 w ; p < m + 1 6 ; p + +
0003060 , q + + ) { \n
0003100 * q = * p ; \n
0003120 } \n p m 3 = w +
0003140 1 3 ; p m 8 = w + 8 ; p
0003160 m 1 4 = w + 2 ; p m 1 6 = w ;
0003200 \n f o r ( p = w + 1 6
0003220 ; p < w + 8 0 ; p + + ,
0003240 p m 3 + + , p m 8 + + , p
0003260 m 1 4 + + , p m 1 6 + + ) {
0003300 \n * p = * p
0003320 m 3 ^ * p m 8 ^ * p m 1
0003340 4 ^ * p m 1 6 ; \n
0003360 } \n f o r ( i =
0003400 0 ; i < 2 0 ; i + + ) { \n
0003420 t e m p = S
0003440 5 ( A ) + F 0 ( B , C , D )
0003460 + E + w [ i ] + K 0
0003500 ; \n E = D ; D
0003520 = C ; C = S 3 0 ( B ) ; B =
0003540 A ; A = t e m p ; \n
0003560 } \n f o r ( i =
0003600 2 0 ; i < 4 0 ; i + + ) {
0003620 \n t e m p =
0003640 S 5 ( A ) + F 1 ( B , C , D
0003660 ) + E + w [ i ] + K
0003700 1 ; \n E = D ;
0003720 D = C ; C = S 3 0 ( B ) ; B
0003740 = A ; A = t e m p ; \n
0003760 } \n f o r ( i
0004000 = 4 0 ; i < 6 0 ; i + + )
0004020 { \n t e m p =
0004040 S 5 ( A ) + F 2 ( B , C ,
0004060 D ) + E + w [ i ] +
0004100 K 2 ; \n E = D ;
0004120 D = C ; C = S 3 0 ( B ) ;
0004140 B = A ; A = t e m p ; \n
0004160 } \n f o r (
0004200 i = 6 0 ; i < 8 0 ; i + + )
0004220 { \n t e m p
0004240 = S 5 ( A ) + F 1 ( B , C
0004260 , D ) + E + w [ i ] +
0004300 K 3 ; \n E = D
0004320 ; D = C ; C = S 3 0 ( B ) ;
0004340 B = A ; A = t e m p ; \n
0004360 } \n h [ 0 ]
0004400 = h [ 0 ] + A ; \n h [ 1
0004420 ] = h [ 1 ] + B ; \n h [
0004440 2 ] = h [ 2 ] + C ; \n h
0004460 [ 3 ] = h [ 3 ] + D ; \n
0004500 h [ 4 ] = h [ 4 ] + E ; \n
0004520 } \n
0004527