KDB: Print binary data in hexadecimal form
This commit closes
@@ -159,8 +159,22 @@ int GetCommand::execute (Cmdline const & cl)
{
cout << "The resulting keyname is " << k.getName () << std::endl;
}
+
+ if (k.isBinary ())
+ {
+ cout << std::hex;
+ const uint8_t * data = static_cast<const uint8_t *> (k.getValue ());
+ for (auto byte = 0; byte < k.getBinarySize (); byte++)
+ {
+ cout << "\\x" << unsigned(data[byte]);
+ }
+ cout << std::dec;
+ }
+ else
+ {
cout << k.getString ();
}
+ }
else
{
cerr << "Did not find key";
