#pragma once #include #include "common/format.h" #include "crypto.h" #include "hash.h" namespace crypto { template constexpr bool is_hex_printable = false; template constexpr bool is_hex_printable && sizeof(T) == sizeof(ec_point)>> = true; template <> inline constexpr bool is_hex_printable = true; template <> inline constexpr bool is_hex_printable = true; template <> inline constexpr bool is_hex_printable = true; template <> inline constexpr bool is_hex_printable = true; template <> inline constexpr bool is_hex_printable = true; template inline constexpr bool is_hex_printable = is_hex_printable; template inline constexpr bool is_hex_printable = is_hex_printable; template inline constexpr bool is_hex_printable = is_hex_printable; // Helper for when you are really sure you want to print a secret key (which is not printable by // default so that you have to be explicit and can't accidentally expose one in a log // statement). inline std::string expose_secret(const ec_scalar& secret) { return "<{}>"_format(tools::type_to_hex(secret)); } } template struct fmt::formatter>> : fmt::formatter { auto format(const T& v, format_context& ctx) { return formatter::format("<{}>"_format(tools::type_to_hex(v)), ctx); } };