18 lines
401 B
C++
18 lines
401 B
C++
//
|
|
// Created by versustune on 23.02.20.
|
|
//
|
|
|
|
#include "Utils.h"
|
|
|
|
std::string Utils::stringToHex(const std::string &input) {
|
|
static const char hex_digits[] = "0123456789ABCDEF";
|
|
|
|
std::string output;
|
|
output.reserve(input.length() * 2);
|
|
for (unsigned char c : input) {
|
|
output.push_back(hex_digits[c >> 4]);
|
|
output.push_back(hex_digits[c & 15]);
|
|
}
|
|
return output;
|
|
}
|