Mercurial > libavutil.hg
changeset 302:901256787a89 libavutil
factorize VARIANT2 (smaller and slower)
author | michael |
---|---|
date | Tue, 13 Mar 2007 01:13:38 +0000 |
parents | b1c6f2421786 |
children | 5b46b6b71fe2 |
files | sha1.c |
diffstat | 1 files changed, 9 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/sha1.c Tue Mar 13 00:35:18 2007 +0000 +++ b/sha1.c Tue Mar 13 01:13:38 2007 +0000 @@ -86,32 +86,15 @@ 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);