#include "common.hh" #include "hash_method.hh" std::string HashMethod::to_string(uint8_t const* data, size_t len) { static const char kChar[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; std::string ret; ret.reserve(len * 2); for (size_t i = 0; i < len; ++i) { ret.push_back(kChar[data[i] >> 4]); ret.push_back(kChar[data[i] & 0xf]); } return ret; }