[vlc-devel] [PATCH v3 03/14] test: md5: update test to use new md5 hash API

Marvin Scholz epirat07 at gmail.com
Wed Apr 8 16:10:13 CEST 2020


---
 src/test/md5.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/test/md5.c b/src/test/md5.c
index f99f2ff3a0..f26d6a63fe 100644
--- a/src/test/md5.c
+++ b/src/test/md5.c
@@ -28,7 +28,7 @@
 #include <string.h>
 
 #include <vlc_common.h>
-#include <vlc_md5.h>
+#include <vlc_hash.h>
 
 typedef struct
 {
@@ -55,11 +55,11 @@ static void test_vlc_hash_md5()
 {
     for( int i = 0; md5_samples[i].psz_string; i++ )
     {
-        struct md5_s md5;
-        InitMD5( &md5 );
-        AddMD5( &md5, md5_samples[i].psz_string, strlen( md5_samples[i].psz_string ) );
-        EndMD5( &md5 );
-        char * psz_hash = psz_md5_hash( &md5 );
+        char psz_hash[VLC_HASH_MD5_DIGEST_HEX_SIZE];
+        vlc_hash_md5_t md5;
+        vlc_hash_md5_Init( &md5 );
+        vlc_hash_md5_Update( &md5, md5_samples[i].psz_string, strlen( md5_samples[i].psz_string ) );
+        vlc_hash_md5_FinishHex( &md5, psz_hash, sizeof(psz_hash) );
 
         if( strcmp( psz_hash, md5_samples[i].psz_md5 ) )
         {
@@ -67,7 +67,6 @@ static void test_vlc_hash_md5()
                     md5_samples[i].psz_md5 );
             abort();
         }
-        free( psz_hash );
     }
 }
 
-- 
2.24.1 (Apple Git-126)



More information about the vlc-devel mailing list