diff options
author | Max Kellermann <max@musicpd.org> | 2018-07-26 17:45:45 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-07-26 17:45:45 +0200 |
commit | 409d3c7136a62d9b73706f05aaefc04e60652164 (patch) | |
tree | ce93f8fb61df7cfcf46dfd3c69b79695eea11ab2 /src/lib/gcrypt | |
parent | 7f81375861eb65784e60d0f7a9ca5f416f67d772 (diff) |
lib/gcrypt/MD5: return a StringBuffer
Diffstat (limited to 'src/lib/gcrypt')
-rw-r--r-- | src/lib/gcrypt/MD5.cxx | 6 | ||||
-rw-r--r-- | src/lib/gcrypt/MD5.hxx | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/gcrypt/MD5.cxx b/src/lib/gcrypt/MD5.cxx index c45d3d9da..621c8c29e 100644 --- a/src/lib/gcrypt/MD5.cxx +++ b/src/lib/gcrypt/MD5.cxx @@ -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; diff --git a/src/lib/gcrypt/MD5.hxx b/src/lib/gcrypt/MD5.hxx index d4a1f57d0..478a7ef12 100644 --- a/src/lib/gcrypt/MD5.hxx +++ b/src/lib/gcrypt/MD5.hxx @@ -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 |