[FFmpeg-devel] [PATCH] fate: replace custom md5 tests with those from RFC 1321

James Almer jamrial at gmail.com
Tue Nov 3 08:09:43 CET 2015


Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavutil/md5.c    | 23 ++++++++++-------------
 tests/ref/fate/md5 | 12 +++++++-----
 2 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/libavutil/md5.c b/libavutil/md5.c
index 876bd55..2a77304 100644
--- a/libavutil/md5.c
+++ b/libavutil/md5.c
@@ -217,19 +217,16 @@ static void print_md5(uint8_t *md5)
 
 int main(void){
     uint8_t md5val[16];
-    int i;
-    volatile uint8_t in[1000]; // volatile to workaround http://llvm.org/bugs/show_bug.cgi?id=20849
-    // FIXME remove volatile once it has been fixed and all fate clients are updated
-
-    for (i = 0; i < 1000; i++)
-        in[i] = i * i;
-    av_md5_sum(md5val, in, 1000); print_md5(md5val);
-    av_md5_sum(md5val, in,   63); print_md5(md5val);
-    av_md5_sum(md5val, in,   64); print_md5(md5val);
-    av_md5_sum(md5val, in,   65); print_md5(md5val);
-    for (i = 0; i < 1000; i++)
-        in[i] = i % 127;
-    av_md5_sum(md5val, in,  999); print_md5(md5val);
+
+    av_md5_sum(md5val, "",    0); print_md5(md5val);
+    av_md5_sum(md5val, "a",   1); print_md5(md5val);
+    av_md5_sum(md5val, "abc", 3); print_md5(md5val);
+    av_md5_sum(md5val, "message digest",             14); print_md5(md5val);
+    av_md5_sum(md5val, "abcdefghijklmnopqrstuvwxyz", 26); print_md5(md5val);
+    av_md5_sum(md5val, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcde"
+                       "fghijklmnopqrstuvwxyz0123456789",          62); print_md5(md5val);
+    av_md5_sum(md5val, "1234567890123456789012345678901234567890"
+                       "1234567890123456789012345678901234567890", 80); print_md5(md5val);
 
     return 0;
 }
diff --git a/tests/ref/fate/md5 b/tests/ref/fate/md5
index af08a84..bb86bb6 100644
--- a/tests/ref/fate/md5
+++ b/tests/ref/fate/md5
@@ -1,5 +1,7 @@
-0bf1bcc8a1d72e2cf58d42182b637e56
-993a3eb298e52aca83ecfbb6a766b4d0
-07c01ca7c733475fad38c84c56f305c1
-9fc8404827cac26385f48f4f58fd32ce
-a22bfef14302c5ca46e0ae91092bc0e0
+d41d8cd98f00b204e9800998ecf8427e
+0cc175b9c0f1b6a831c399e269772661
+900150983cd24fb0d6963f7d28e17f72
+f96b697d7cb7938d525a2f31aaf161d0
+c3fcd3d76192e4007dfb496cca67e13b
+d174ab98d277d9f5a5611c2c9f419d9f
+57edf4a22be3c955ac49da2e2107b67a
-- 
2.6.2



More information about the ffmpeg-devel mailing list