| 353 | } |
| 354 | |
| 355 | std::string Data::toHex(const void *data, const size_t dataLength) |
| 356 | { |
| 357 | if (!data || dataLength == 0) |
| 358 | return ""; |
| 359 | |
| 360 | static const char hexTable[] = "0123456789ABCDEF"; |
| 361 | const auto *byteData = reinterpret_cast<const uint8_t *>(data); |
| 362 | |
| 363 | std::string hexString; |
| 364 | hexString.resize(dataLength * 2); |
| 365 | |
| 366 | for (size_t i = 0; i < dataLength; ++i) |
| 367 | { |
| 368 | hexString[i * 2] = hexTable[(byteData[i] >> 4) & 0x0F]; |
| 369 | hexString[i * 2 + 1] = hexTable[byteData[i] & 0x0F]; |
| 370 | } |
| 371 | |
| 372 | return hexString; |
| 373 | } |
| 374 | |
| 375 | namespace Zip |
| 376 | { |
nothing calls this directly
no outgoing calls
no test coverage detected