Skip to content

Commit dd7e9ae

Browse files
committed
Move template pair into detail namespace so we can do u16, u32, etc
1 parent ebc10a3 commit dd7e9ae

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

include/boost/crypt/hash/md5.hpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,8 @@ BOOST_CRYPT_GPU_ENABLED constexpr auto md5_hasher::md5_body() noexcept -> void
346346
d0_ += d;
347347
}
348348

349+
namespace detail {
350+
349351
template <typename T>
350352
BOOST_CRYPT_GPU_ENABLED constexpr auto md5(T begin, T end) noexcept -> boost::crypt::array<boost::crypt::uint8_t, 16>
351353
{
@@ -355,7 +357,9 @@ BOOST_CRYPT_GPU_ENABLED constexpr auto md5(T begin, T end) noexcept -> boost::cr
355357
}
356358
else if (end == begin)
357359
{
358-
return boost::crypt::array<boost::crypt::uint8_t, 16>{0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04, 0xe9, 0x80, 0x09, 0x98, 0xec, 0xf8, 0x42, 0x7e};
360+
return boost::crypt::array<boost::crypt::uint8_t, 16> {
361+
0xd4, 0x1d, 0x8c, 0xd9, 0x8f, 0x00, 0xb2, 0x04, 0xe9, 0x80, 0x09, 0x98, 0xec, 0xf8, 0x42, 0x7e
362+
};
359363
}
360364

361365
boost::crypt::md5_hasher hasher;
@@ -365,6 +369,8 @@ BOOST_CRYPT_GPU_ENABLED constexpr auto md5(T begin, T end) noexcept -> boost::cr
365369
return result;
366370
}
367371

372+
} // Namespace detail
373+
368374
BOOST_CRYPT_GPU_ENABLED constexpr auto md5(const char* str) noexcept -> boost::crypt::array<boost::crypt::uint8_t, 16>
369375
{
370376
if (str == nullptr)
@@ -373,7 +379,7 @@ BOOST_CRYPT_GPU_ENABLED constexpr auto md5(const char* str) noexcept -> boost::c
373379
}
374380

375381
const auto message_len {utility::strlen(str)};
376-
return md5(str, str + message_len);
382+
return detail::md5(str, str + message_len);
377383
}
378384

379385
BOOST_CRYPT_GPU_ENABLED constexpr auto md5(const char* str, boost::crypt::size_t len) noexcept -> boost::crypt::array<boost::crypt::uint8_t, 16>
@@ -383,20 +389,20 @@ BOOST_CRYPT_GPU_ENABLED constexpr auto md5(const char* str, boost::crypt::size_t
383389
return boost::crypt::array<boost::crypt::uint8_t, 16>{};
384390
}
385391

386-
return md5(str, str + len);
392+
return detail::md5(str, str + len);
387393
}
388394

389395
// ----- String and String view aren't in the libcu++ STL so they so not have device markers -----
390396

391397
inline auto md5(const std::string& str) noexcept -> boost::crypt::array<boost::crypt::uint8_t, 16>
392398
{
393-
return md5(str.begin(), str.end());
399+
return detail::md5(str.begin(), str.end());
394400
}
395401

396402
#ifdef BOOST_CRYPT_HAS_STRING_VIEW
397403
inline auto md5(const std::string_view& str) -> boost::crypt::array<boost::crypt::uint8_t, 16>
398404
{
399-
return md5(str.begin(), str.end());
405+
return detail::md5(str.begin(), str.end());
400406
}
401407
#endif
402408

0 commit comments

Comments
 (0)