45 std::stringstream hexStream;
51 hexStream << std::hex;
53 int currentPrefixLength = prefixAtFirstLine ? prefixLength : 0;
56 for (i = 0; i < length; i++) {
62 hexStream <<
" " << buff << std::endl;
66 hexStream << Color::Code::FG_BLUE;
67 hexStream << std::setw(currentPrefixLength) << std::setfill(
' ') <<
""
68 <<
": " << std::setw(8) << std::setfill(
'0') <<
static_cast<
unsigned int>(i);
69 hexStream << Color::Code::FG_DEFAULT <<
" ";
73 hexStream << Color::Code::FG_GREEN;
74 hexStream <<
" " << std::setw(2) << std::setfill(
'0') <<
static_cast<
unsigned int>(
static_cast<
unsigned char>(bytes[i]));
75 hexStream << Color::Code::FG_DEFAULT;
78 if ((bytes[i] < 0x20) || (bytes[i] > 0x7e)) {
81 buff[i % 16] =
static_cast<uint8_t>(bytes[i]);
83 buff[(i % 16) + 1] =
'\0';
85 currentPrefixLength = prefixLength;
88 hexStream << std::dec;
91 while ((i % 16) != 0) {
97 hexStream <<
" " << buff;
100 return hexStream.str();