{
string_view buffer(static_cast<const char*>(data), size);
hash_buffer(buffer);
- add_debug_text(buffer);
- if (hash_type == HashType::text) {
- add_debug_text("\n");
+
+ switch (hash_type) {
+ case HashType::binary:
+ add_debug_text(Util::format_hex(static_cast<const uint8_t*>(data), size));
+ break;
+
+ case HashType::text:
+ add_debug_text(buffer);
+ break;
}
+
+ add_debug_text("\n");
return *this;
}
// Add bytes to the hash.
//
- // If hash debugging is enabled, the buffer content is written verbatim to the
- // text input file, followed by a newline character if `hash_type` is
- // HashType::text.
+ // If hash debugging is enabled:
+ //
+ // - If `hash_type` is `HashType::binary`, the buffer content is written in
+ // hex format to the text input file.
+ // - If `hash_type` is `HashType::text`, the buffer content is written
+ // verbatim to the text input file.
+ //
+ // In both cases a newline character is added as well.
Hash&
hash(const void* data, size_t size, HashType hash_type = HashType::text);