From f62227aa95f96901b75670d3914971593f65f119 Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Sun, 30 Sep 2018 18:13:02 -0400 Subject: hex_util: Add HexVectorToString and HexStringToVector Converts between bytes and strings when the size is not known at compile time. --- src/common/hex_util.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/common/hex_util.h') diff --git a/src/common/hex_util.h b/src/common/hex_util.h index 863a5ccd9..0b7d3592a 100644 --- a/src/common/hex_util.h +++ b/src/common/hex_util.h @@ -7,6 +7,7 @@ #include #include #include +#include #include #include "common/common_types.h" @@ -14,6 +15,8 @@ namespace Common { u8 ToHexNibble(char c1); +std::vector HexStringToVector(std::string_view str, bool little_endian); + template std::array HexStringToArray(std::string_view str) { std::array out{}; @@ -27,6 +30,8 @@ std::array HexStringToArray(std::string_view str) { return out; } +std::string HexVectorToString(std::vector vector, bool upper = true); + template std::string HexArrayToString(std::array array, bool upper = true) { std::string out; -- cgit v1.2.3