[vlc-devel] [PATCH 05/14] audioscrobbler: use new md5 API
Marvin Scholz
epirat07 at gmail.com
Wed Apr 1 21:47:33 CEST 2020
---
modules/misc/audioscrobbler.c | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/modules/misc/audioscrobbler.c b/modules/misc/audioscrobbler.c
index 7506488041..d2e08c0675 100644
--- a/modules/misc/audioscrobbler.c
+++ b/modules/misc/audioscrobbler.c
@@ -44,7 +44,7 @@
#include <vlc_input_item.h>
#include <vlc_dialog.h>
#include <vlc_meta.h>
-#include <vlc_md5.h>
+#include <vlc_hash.h>
#include <vlc_memstream.h>
#include <vlc_stream.h>
#include <vlc_url.h>
@@ -466,7 +466,7 @@ static int Handshake(intf_thread_t *p_this)
time_t timestamp;
char psz_timestamp[21];
- struct md5_s p_struct_md5;
+ vlc_hash_md5_t p_struct_md5;
stream_t *p_stream;
char *psz_handshake_url;
@@ -493,13 +493,11 @@ static int Handshake(intf_thread_t *p_this)
time(×tamp);
/* generates a md5 hash of the password */
- InitMD5(&p_struct_md5);
- AddMD5(&p_struct_md5, (uint8_t*) psz_password, strlen(psz_password));
- EndMD5(&p_struct_md5);
-
+ vlc_hash_md5_Init(&p_struct_md5);
+ vlc_hash_md5_Update(&p_struct_md5, psz_password, strlen(psz_password));
free(psz_password);
- char *psz_password_md5 = psz_md5_hash(&p_struct_md5);
+ char *psz_password_md5 = vlc_hash_md5_FinishHex(&p_struct_md5);
if (!psz_password_md5)
{
free(psz_username);
@@ -513,13 +511,12 @@ static int Handshake(intf_thread_t *p_this)
* - md5 hash of the password, plus
* - timestamp in clear text
*/
- InitMD5(&p_struct_md5);
- AddMD5(&p_struct_md5, (uint8_t*) psz_password_md5, 32);
- AddMD5(&p_struct_md5, (uint8_t*) psz_timestamp, strlen(psz_timestamp));
- EndMD5(&p_struct_md5);
+ vlc_hash_md5_Init(&p_struct_md5);
+ vlc_hash_md5_Update(&p_struct_md5, psz_password_md5, 32);
+ vlc_hash_md5_Update(&p_struct_md5, psz_timestamp, strlen(psz_timestamp));
free(psz_password_md5);
- char *psz_auth_token = psz_md5_hash(&p_struct_md5);
+ char *psz_auth_token = vlc_hash_md5_FinishHex(&p_struct_md5);
if (!psz_auth_token)
{
free(psz_username);
--
2.24.1 (Apple Git-126)
More information about the vlc-devel
mailing list