lib/gcrypt/MD5: return a StringBuffer
This commit is contained in:
parent
7f81375861
commit
409d3c7136
@ -213,7 +213,7 @@ QobuzClient::MakeSignedUrl(const char *object, const char *method,
|
|||||||
concatenated_query += app_secret;
|
concatenated_query += app_secret;
|
||||||
|
|
||||||
const auto md5_hex = MD5Hex({concatenated_query.data(), concatenated_query.size()});
|
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;
|
return uri;
|
||||||
}
|
}
|
||||||
|
@ -38,13 +38,13 @@ MD5(ConstBuffer<void> input) noexcept
|
|||||||
return Gcrypt::Hash<GCRY_MD_MD5, 16>(input);
|
return Gcrypt::Hash<GCRY_MD_MD5, 16>(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::array<char, 33>
|
StringBuffer<33>
|
||||||
MD5Hex(ConstBuffer<void> input) noexcept
|
MD5Hex(ConstBuffer<void> input) noexcept
|
||||||
{
|
{
|
||||||
const auto raw = MD5(input);
|
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) {
|
for (const auto i : raw) {
|
||||||
sprintf(p, "%02x", i);
|
sprintf(p, "%02x", i);
|
||||||
p += 2;
|
p += 2;
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#ifndef GCRYPT_MD5_HXX
|
#ifndef GCRYPT_MD5_HXX
|
||||||
#define GCRYPT_MD5_HXX
|
#define GCRYPT_MD5_HXX
|
||||||
|
|
||||||
|
#include "util/StringBuffer.hxx"
|
||||||
#include "Compiler.h"
|
#include "Compiler.h"
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
@ -41,7 +42,7 @@ std::array<uint8_t, 16>
|
|||||||
MD5(ConstBuffer<void> input) noexcept;
|
MD5(ConstBuffer<void> input) noexcept;
|
||||||
|
|
||||||
gcc_pure
|
gcc_pure
|
||||||
std::array<char, 33>
|
StringBuffer<33>
|
||||||
MD5Hex(ConstBuffer<void> input) noexcept;
|
MD5Hex(ConstBuffer<void> input) noexcept;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user