DoorKeeper/include/doorkeeper/implem/hashing.inl

20 lines
736 B
C++

namespace dk {
template <typename T, uint32_t D>
inline HashType make_signature_hash() {
#if defined(IS_PRETTY_FUNC_CONSTEXPR)
//static_assert(dk::tiger("a", 1, 0x01).a == 0xABF87E2EEFFBBE77ULL, "Bug in tiger hash");
//static_assert(dk::tiger("message digest", 14, 0x01).a == 0x951A2078CBF881D9ULL, "Bug in tiger hash");
constexpr bt::string<sizeof(__PRETTY_FUNCTION__)-1> func_pretty(__PRETTY_FUNCTION__);
// set padding to 0x80 for tiger V2
constexpr HashType retval = dk::tiger(func_pretty.data(), func_pretty.size(), 0x01);
return retval;
#else
const char* const pf = __PRETTY_FUNCTION__;
const std::size_t len = sizeof(__PRETTY_FUNCTION__) - 1;
return implem::hash_string(pf, len);
#endif
}
} //namespace dk