Commit 36c7fa7e authored by Michael Niedermayer's avatar Michael Niedermayer

smaller av_sha1_update()

Originally committed as revision 8381 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 104c30ee
...@@ -90,6 +90,15 @@ void av_sha1_update(AVSHA1* context, uint8_t* data, unsigned int len){ ...@@ -90,6 +90,15 @@ void av_sha1_update(AVSHA1* context, uint8_t* data, unsigned int len){
j = context->count & 63; j = context->count & 63;
context->count += len; context->count += len;
#ifdef CONFIG_SMALL
for( i = 0; i < len; i++ ){
context->buffer[ j++ ] = data[i];
if( 64 == j ){
transform(context->state, context->buffer);
j = 0;
}
}
#else
if ((j + len) > 63) { if ((j + len) > 63) {
memcpy(&context->buffer[j], data, (i = 64-j)); memcpy(&context->buffer[j], data, (i = 64-j));
transform(context->state, context->buffer); transform(context->state, context->buffer);
...@@ -100,6 +109,7 @@ void av_sha1_update(AVSHA1* context, uint8_t* data, unsigned int len){ ...@@ -100,6 +109,7 @@ void av_sha1_update(AVSHA1* context, uint8_t* data, unsigned int len){
} }
else i = 0; else i = 0;
memcpy(&context->buffer[j], &data[i], len - i); memcpy(&context->buffer[j], &data[i], len - i);
#endif
} }
void av_sha1_final(AVSHA1* context, uint8_t digest[20]){ void av_sha1_final(AVSHA1* context, uint8_t digest[20]){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment