Add a variant of hex_encode
This commit is contained in:
parent
e71262463f
commit
524c78a8d6
@ -24,7 +24,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
|
|
||||||
static const char hex_chars[] = "0123456789abcdef";
|
static const char hex_chars[] = "0123456789abcdef";
|
||||||
|
|
||||||
static std::string hex_encode(const char *data, unsigned int data_size)
|
static inline std::string hex_encode(const char *data, unsigned int data_size)
|
||||||
{
|
{
|
||||||
std::string ret;
|
std::string ret;
|
||||||
char buf2[3];
|
char buf2[3];
|
||||||
@ -41,4 +41,9 @@ static std::string hex_encode(const char *data, unsigned int data_size)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline std::string hex_encode(const std::string &data)
|
||||||
|
{
|
||||||
|
return hex_encode(data.c_str(), data.size());
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user