aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee/src/http_auth.cpp
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2017-04-24 10:29:19 +0200
committerRiccardo Spagni <ric@spagni.net>2017-04-24 10:29:19 +0200
commita059e91d7fbdbf8745e48dd1c86e336483ff778c (patch)
tree27b42a557478acdee579b1f0ce649ca06218c1fc /contrib/epee/src/http_auth.cpp
parentMerge pull request #1956 (diff)
parentSimplified the implementation and features of span (diff)
downloadmonero-a059e91d7fbdbf8745e48dd1c86e336483ff778c.tar.xz
Merge pull request #1816
93e10f1c Simplified the implementation and features of span (Lee Clagett) 4a8f96f9 Improvements for epee binary to hex functions: (Lee Clagett)
Diffstat (limited to 'contrib/epee/src/http_auth.cpp')
-rw-r--r--contrib/epee/src/http_auth.cpp22
1 files changed, 2 insertions, 20 deletions
diff --git a/contrib/epee/src/http_auth.cpp b/contrib/epee/src/http_auth.cpp
index 5a1c2142a..30e562700 100644
--- a/contrib/epee/src/http_auth.cpp
+++ b/contrib/epee/src/http_auth.cpp
@@ -67,6 +67,7 @@
#include <type_traits>
#include "crypto/crypto.h"
+#include "hex.h"
#include "md5_l.h"
#include "string_coding.h"
@@ -104,25 +105,6 @@ namespace
//// Digest Algorithms
- template<std::size_t N>
- std::array<char, N * 2> to_hex(const std::array<std::uint8_t, N>& digest) noexcept
- {
- static constexpr const char alphabet[] = u8"0123456789abcdef";
- static_assert(sizeof(alphabet) == 17, "bad alphabet size");
-
- // TODO upgrade (improve performance) of to hex in epee string tools
- std::array<char, N * 2> out{{}};
- auto current = out.begin();
- for (const std::uint8_t byte : digest)
- {
- *current = alphabet[byte >> 4];
- ++current;
- *current = alphabet[byte & 0x0F];
- ++current;
- }
- return out;
- }
-
struct md5_
{
static constexpr const boost::string_ref name = ceref(u8"MD5");
@@ -156,7 +138,7 @@ namespace
std::array<std::uint8_t, 16> digest{{}};
md5::MD5Final(digest.data(), std::addressof(ctx));
- return to_hex(digest);
+ return epee::to_hex::array(digest);
}
};
constexpr const boost::string_ref md5_::name;