| 747 | } |
| 748 | |
| 749 | Format parse_format(const std::string& s) { |
| 750 | if (s == "raw") return Format::Raw; |
| 751 | if (s == "hex") return Format::Hex; |
| 752 | if (s == "c" || s == "cpp" || s == "h") return Format::C; |
| 753 | if (s == "py" || s == "python") return Format::Py; |
| 754 | if (s == "ps1" || s == "powershell") return Format::Ps1; |
| 755 | if (s == "b64" || s == "base64") return Format::B64; |
| 756 | if (s == "nasm" || s == "asm") return Format::Nasm; |
| 757 | throw mkpivm::Error("unknown --format: " + s + ", expected raw|hex|c|py|ps1|b64|nasm"); |
| 758 | } |
| 759 | |
| 760 | std::string fmt_hex(const std::vector<std::uint8_t>& v) { |
| 761 | std::string s; |