summaryrefslogtreecommitdiff
path: root/libavutil/sha1.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2007-03-12 21:29:39 +0000
committerMichael Niedermayer <michaelni@gmx.at>2007-03-12 21:29:39 +0000
commit11bf0eb69a874fdcc7c9e21deda087c4a6dfbb5e (patch)
tree00011c593abbae80832a57dc9d811ecbf4a1fff7 /libavutil/sha1.c
parentde953b6b67705c3487844b00bb89e0bccf231b24 (diff)
make count count bytes not bits (this is simpler and leads to a very slightly smaller object file)
Originally committed as revision 8357 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil/sha1.c')
-rw-r--r--libavutil/sha1.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavutil/sha1.c b/libavutil/sha1.c
index 5ecb8f533c..4314055c1b 100644
--- a/libavutil/sha1.c
+++ b/libavutil/sha1.c
@@ -73,8 +73,8 @@ void av_sha1_init(AVSHA1* context){
void av_sha1_update(AVSHA1* context, uint8_t* data, unsigned int len){
unsigned int i, j;
- j = (context->count >> 3) & 63;
- context->count += len << 3;
+ j = context->count & 63;
+ context->count += len;
if ((j + len) > 63) {
memcpy(&context->buffer[j], data, (i = 64-j));
transform(context->state, context->buffer);
@@ -88,10 +88,10 @@ void av_sha1_update(AVSHA1* context, uint8_t* data, unsigned int len){
void av_sha1_final(AVSHA1* context, uint8_t digest[20]){
int i;
- uint64_t finalcount= be2me_64(context->count);
+ uint64_t finalcount= be2me_64(context->count<<3);
av_sha1_update(context, "\200", 1);
- while ((context->count & 504) != 448) {
+ while ((context->count & 63) != 56) {
av_sha1_update(context, "\0", 1);
}
av_sha1_update(context, &finalcount, 8); /* Should cause a transform() */