X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavutil%2Fmd5.c;h=d33ad14830dca20688b1678bbcdd63cbe34a3c96;hb=f81b99b82b807e6a7716cf47e4d1748b32ca4b39;hp=844bcb0e8034eb43d62c46701dbab11ce690d6a3;hpb=d10fda8ee2a25f21563869728fe1d6abfb04f9ae;p=ffmpeg diff --git a/libavutil/md5.c b/libavutil/md5.c index 844bcb0e803..d33ad14830d 100644 --- a/libavutil/md5.c +++ b/libavutil/md5.c @@ -1,7 +1,22 @@ /* * Copyright (C) 2006 Michael Niedermayer (michaelni@gmx.at) * Copyright (C) 2003-2005 by Christopher R. Hertel (crh@ubiqx.mn.org) - * #inlcude LGPL license + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * * References: * IETF RFC 1321: The MD5 Message-Digest Algorithm @@ -12,7 +27,7 @@ * simplified, cleaned and IMO redundant comments removed by michael * * if you use gcc, then version 4.1 or later and -fomit-frame-pointer is - * strongly recommanded + * strongly recommended */ #include "common.h" @@ -69,7 +84,8 @@ static const uint32_t T[64] = { }\ a = b + (( a << t ) | ( a >> (32 - t) )); -static void body(uint32_t ABCD[4], const uint32_t X[16]){ +static void body(uint32_t ABCD[4], uint32_t X[16]){ + int t; int i attribute_unused; unsigned int a= ABCD[3]; @@ -117,7 +133,7 @@ void av_md5_update(AVMD5 *ctx, const uint8_t *src, const int len){ for( i = 0; i < len; i++ ){ ctx->block[ ctx->b_used++ ] = src[i]; if( 64 == ctx->b_used ){ - body(ctx->ABCD, (const uint32_t*) ctx->block); + body(ctx->ABCD, (uint32_t*) ctx->block); ctx->b_used = 0; } } @@ -131,14 +147,14 @@ void av_md5_final(AVMD5 *ctx, uint8_t *dst){ memset(&ctx->block[ctx->b_used], 0, 64 - ctx->b_used); if( 56 < ctx->b_used ){ - body( ctx->ABCD, (const uint32_t*) ctx->block ); + body( ctx->ABCD, (uint32_t*) ctx->block ); memset(ctx->block, 0, 64); } for(i=0; i<8; i++) ctx->block[56+i] = (ctx->len << 3) >> (i<<3); - body(ctx->ABCD, (const uint32_t*) ctx->block); + body(ctx->ABCD, (uint32_t*) ctx->block); for(i=0; i<4; i++) ((uint32_t*)dst)[i]= le2me_32(ctx->ABCD[3-i]); @@ -160,11 +176,11 @@ main(){ uint8_t in[1000]; for(i=0; i<1000; i++) in[i]= i*i; - av_md5_sum( (uint8_t*)&md5val, in, 1000); printf("%lld\n", md5val); - av_md5_sum( (uint8_t*)&md5val, in, 63); printf("%lld\n", md5val); - av_md5_sum( (uint8_t*)&md5val, in, 64); printf("%lld\n", md5val); - av_md5_sum( (uint8_t*)&md5val, in, 65); printf("%lld\n", md5val); + av_md5_sum( (uint8_t*)&md5val, in, 1000); printf("%"PRId64"\n", md5val); + av_md5_sum( (uint8_t*)&md5val, in, 63); printf("%"PRId64"\n", md5val); + av_md5_sum( (uint8_t*)&md5val, in, 64); printf("%"PRId64"\n", md5val); + av_md5_sum( (uint8_t*)&md5val, in, 65); printf("%"PRId64"\n", md5val); for(i=0; i<1000; i++) in[i]= i % 127; - av_md5_sum( (uint8_t*)&md5val, in, 999); printf("%lld\n", md5val); + av_md5_sum( (uint8_t*)&md5val, in, 999); printf("%"PRId64"\n", md5val); } #endif