diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2007-03-13 01:13:38 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2007-03-13 01:13:38 +0000 |
commit | 2fa3a22d2388e7de1211297b38045c60561e7f86 (patch) | |
tree | 563976ab366a19d99eed1c98adc675154862fc22 /libavutil | |
parent | d6cf7804190a9588473e6afdae207d06951d978a (diff) | |
download | ffmpeg-streaming-2fa3a22d2388e7de1211297b38045c60561e7f86.zip ffmpeg-streaming-2fa3a22d2388e7de1211297b38045c60561e7f86.tar.gz |
factorize VARIANT2 (smaller and slower)
Originally committed as revision 8372 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/sha1.c | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/libavutil/sha1.c b/libavutil/sha1.c index 5b7f818..7f5b768 100644 --- a/libavutil/sha1.c +++ b/libavutil/sha1.c @@ -86,32 +86,15 @@ static void transform(uint32_t state[5], uint8_t buffer[64]){ d = state[3]; e = state[4]; #ifdef VARIANT2 - for(i=0; i<20; i++){ - int t= R0b(a,b,c,d,e,i); - e= d; - d= c; - c= rol(b,30); - b= a; - a= t; - } - for(; i<40; i++){ - int t= R2b(a,b,c,d,e,i); - e= d; - d= c; - c= rol(b,30); - b= a; - a= t; - } - for(; i<60; i++){ - int t= R3b(a,b,c,d,e,i); - e= d; - d= c; - c= rol(b,30); - b= a; - a= t; - } - for(; i<80; i++){ - int t= R4b(a,b,c,d,e,i); + for(i=0; i<80; i++){ + int t= e+block[i]+rol(a,5);; + if(i<40){ + if(i<20) t+= ((b&(c^d))^d) +0x5A827999; + else t+= ( b^c ^d) +0x6ED9EBA1; + }else{ + if(i<60) t+= (((b|c)&d)|(b&c))+0x8F1BBCDC; + else t+= ( b^c ^d) +0xCA62C1D6; + } e= d; d= c; c= rol(b,30); |