[vlc-devel] [PATCH v3 07/14] lua: sd: use new md5 API

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


---
 modules/lua/libs/sd.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/modules/lua/libs/sd.c b/modules/lua/libs/sd.c
index 7f6c085fb3..64f3e7b170 100644
--- a/modules/lua/libs/sd.c
+++ b/modules/lua/libs/sd.c
@@ -37,7 +37,7 @@
 #include <vlc_common.h>
 #include <vlc_services_discovery.h>
 #include <vlc_charset.h>
-#include <vlc_md5.h>
+#include <vlc_hash.h>
 
 #include "../vlc.h"
 #include "../libs.h"
@@ -215,15 +215,13 @@ static input_item_t *vlclua_sd_create_item( services_discovery_t *p_sd,
         char *s = strdup( luaL_checkstring( L, -1 ) );
         if ( s )
         {
-            struct md5_s md5;
-            InitMD5( &md5 );
-            AddMD5( &md5, s, strlen( s ) );
-            EndMD5( &md5 );
-            free( s );
-            s = psz_md5_hash( &md5 );
-            if ( s )
-                 input_item_AddInfo( p_input, "uid", "md5", "%s", s );
+            vlc_hash_md5_t md5;
+            vlc_hash_md5_Init( &md5 );
+            vlc_hash_md5_Update( &md5, s, strlen( s ) );
             free( s );
+            char tmp[VLC_HASH_MD5_DIGEST_HEX_SIZE];
+            vlc_hash_md5_FinishHex( &md5, tmp, sizeof(tmp) );
+            input_item_AddInfo( p_input, "uid", "md5", "%s", tmp );
         }
     }
     lua_pop( L, 1 );
-- 
2.24.1 (Apple Git-126)



More information about the vlc-devel mailing list