Commit 409d3c71 authored by Max Kellermann's avatar Max Kellermann

lib/gcrypt/MD5: return a StringBuffer

parent 7f813758
......@@ -213,7 +213,7 @@ QobuzClient::MakeSignedUrl(const char *object, const char *method,
concatenated_query += app_secret;
const auto md5_hex = MD5Hex({concatenated_query.data(), concatenated_query.size()});
q(uri, "request_sig", &md5_hex.front());
q(uri, "request_sig", md5_hex);
return uri;
}
......@@ -38,13 +38,13 @@ MD5(ConstBuffer<void> input) noexcept
return Gcrypt::Hash<GCRY_MD_MD5, 16>(input);
}
std::array<char, 33>
StringBuffer<33>
MD5Hex(ConstBuffer<void> input) noexcept
{
const auto raw = MD5(input);
std::array<char, 33> result;
StringBuffer<33> result;
char *p = &result.front();
char *p = result.data();
for (const auto i : raw) {
sprintf(p, "%02x", i);
p += 2;
......
......@@ -30,6 +30,7 @@
#ifndef GCRYPT_MD5_HXX
#define GCRYPT_MD5_HXX
#include "util/StringBuffer.hxx"
#include "Compiler.h"
#include <array>
......@@ -41,7 +42,7 @@ std::array<uint8_t, 16>
MD5(ConstBuffer<void> input) noexcept;
gcc_pure
std::array<char, 33>
StringBuffer<33>
MD5Hex(ConstBuffer<void> input) noexcept;
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment