lib/gcrypt/MD5: move code to util/HexFormat.cxx

This commit is contained in:
Max Kellermann
2018-07-26 17:29:59 +02:00
parent 409d3c7136
commit 7db7568dcf
4 changed files with 110 additions and 9 deletions

View File

@@ -29,6 +29,7 @@
#include "MD5.hxx"
#include "Hash.hxx"
#include "util/HexFormat.hxx"
#include <stdio.h>
@@ -42,13 +43,5 @@ StringBuffer<33>
MD5Hex(ConstBuffer<void> input) noexcept
{
const auto raw = MD5(input);
StringBuffer<33> result;
char *p = result.data();
for (const auto i : raw) {
sprintf(p, "%02x", i);
p += 2;
}
return result;
return HexFormatBuffer<raw.size()>(&raw.front());
}