| 22 | } |
| 23 | |
| 24 | void convertBytesToHexStr(Span<const uint8_t> Src, std::string &Dst, |
| 25 | const uint32_t Padding, const bool IsLittleEndian) { |
| 26 | Dst.clear(); |
| 27 | Dst.reserve(Src.size() * 2); |
| 28 | if (IsLittleEndian) { |
| 29 | for (auto It = Src.rbegin(); It != Src.rend(); It++) { |
| 30 | Dst += fmt::format("{:02x}", *It); |
| 31 | } |
| 32 | } else { |
| 33 | for (auto It = Src.begin(); It != Src.end(); It++) { |
| 34 | Dst += fmt::format("{:02x}", *It); |
| 35 | } |
| 36 | } |
| 37 | if (Dst.length() < Padding) { |
| 38 | Dst = std::string(Padding - Dst.length(), '0').append(Dst); |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | void convertValVecToHexStr(Span<const uint8_t> Src, std::string &Dst, |
| 43 | const uint32_t Padding) { |