[vlc-devel] [PATCH 02/14] src: add cleaner md5 API

Rémi Denis-Courmont remi at remlab.net
Thu Apr 2 08:17:54 CEST 2020


Hi,

If you add a parameter, there's no way to make the init function not allocate memory and return void. I much prefer this specific Nettle style over the generic gcrypt style (at least in C).

Le 2 avril 2020 01:39:41 GMT+03:00, Francois Cartegnie <fcvlcdev at free.fr> a écrit :
>Le 01/04/2020 à 21:47, Marvin Scholz a écrit :
>> +static inline void vlc_hash_BinToHex(void *input, size_t size, char
>*output)
>> +{
>> +    unsigned char *buffer = input;
>> +
>> +    for (size_t i = 0; i < size; i++) {
>> +        sprintf(&output[i * 2], "%02" PRIx8, buffer[i]);
>> +    }
>
>I don't think bin2hex belongs to a specific API.
>
>> +vlc_hash_md5_Init
>> +vlc_hash_md5_Update
>> +vlc_hash_md5_Finish
>> +vlc_hash_md5_FinishHex
>If you add a parameter you won't need a new API for a new hash type
>
>-- 
>Francois Cartegnie
>VideoLAN - VLC Developer
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20200402/bebd73d7/attachment.html>


More information about the vlc-devel mailing list