aboutsummaryrefslogtreecommitdiff
path: root/src/util/strencodings.h
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-11-10 10:49:58 +0100
committerMacroFake <falke.marco@gmail.com>2022-04-27 19:53:17 +0200
commitfae1006019188700e0c497a63fc1550fe00ca8bb (patch)
tree0b0befbf77427a934bb6aeffe1113095e8cb6e59 /src/util/strencodings.h
parentfabdf81983e2542d60542b80fb94ccb1acdd204a (diff)
downloadbitcoin-fae1006019188700e0c497a63fc1550fe00ca8bb.tar.xz
util: Add ParseHex<std::byte>() helper
Diffstat (limited to 'src/util/strencodings.h')
-rw-r--r--src/util/strencodings.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/util/strencodings.h b/src/util/strencodings.h
index ebb6d88952..ee58383528 100644
--- a/src/util/strencodings.h
+++ b/src/util/strencodings.h
@@ -55,7 +55,9 @@ enum class ByteUnit : uint64_t {
* @return A new string without unsafe chars
*/
std::string SanitizeString(std::string_view str, int rule = SAFE_CHARS_DEFAULT);
-std::vector<unsigned char> ParseHex(std::string_view str);
+/** Parse the hex string into bytes (uint8_t or std::byte). Ignores whitespace. */
+template <typename Byte = uint8_t>
+std::vector<Byte> ParseHex(std::string_view str);
signed char HexDigit(char c);
/* Returns true if each character in str is a hex character, and has an even
* number of hex digits.*/