[vlc-devel] [PATCH 3/4] src: test: verify vlc_hash_md5_Finish keeps context usable

Marvin Scholz epirat07 at gmail.com
Thu Jul 23 14:51:58 CEST 2020


---
 src/test/md5.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/src/test/md5.c b/src/test/md5.c
index f952b517d6..ab6952778c 100644
--- a/src/test/md5.c
+++ b/src/test/md5.c
@@ -78,9 +78,30 @@ static void test_vlc_hash_md5()
     }
 }
 
+static void test_vlc_hash_md5_consecutive()
+{
+    char *psz_tmp;
+    char psz_hash[VLC_HASH_MD5_DIGEST_HEX_SIZE];
+    vlc_hash_md5_t md5;
+
+    vlc_hash_md5_Init( &md5 );
+
+    psz_tmp = "a";
+    vlc_hash_md5_Update( &md5, psz_tmp, strlen( psz_tmp ) );
+    vlc_hash_FinishHex( &md5, psz_hash );
+    check_result( psz_hash, "0cc175b9c0f1b6a831c399e269772661" );
+
+    psz_tmp = "bc";
+    vlc_hash_md5_Update( &md5, psz_tmp, strlen( psz_tmp ) );
+    vlc_hash_FinishHex( &md5, psz_hash );
+    check_result( psz_hash, "900150983cd24fb0d6963f7d28e17f72" );
+
+}
+
 int main( void )
 {
     test_vlc_hash_md5();
+    test_vlc_hash_md5_consecutive();
 
     return 0;
 }
-- 
2.24.3 (Apple Git-128)



More information about the vlc-devel mailing list