diff options
Diffstat (limited to '')
-rw-r--r-- | utils/encrypt_bmp.cpp | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/utils/encrypt_bmp.cpp b/utils/encrypt_bmp.cpp index ac6cb92..ad61266 100644 --- a/utils/encrypt_bmp.cpp +++ b/utils/encrypt_bmp.cpp @@ -31,27 +31,24 @@ namespace void encrypt_bmp(const Settings& settings) { - const auto algorithm = settings.get_algorithm(); - const auto mode = settings.get_mode(); - - const auto& plaintext_path = settings.get_input_path(); - const auto& ciphertext_path = settings.get_output_path(); + const auto& algorithm = settings.algorithm; + const auto& mode = settings.mode; aes::Box::Key key; - aes::Box::parse_key(key, algorithm, settings.get_key_string()); + aes::Box::parse_key(key, algorithm, settings.key); - if (aes::mode_requires_initialization_vector(mode)) + if (aes::mode_requires_init_vector(mode)) { aes::Box::Block iv; - aes::Box::parse_block(iv, algorithm, settings.get_iv_string()); - aes::Box box{algorithm, key, mode, iv}; + aes::Box::parse_block(iv, algorithm, settings.iv); - encrypt_bmp(box, plaintext_path, ciphertext_path); + aes::Box box{algorithm, key, mode, iv}; + encrypt_bmp(box, settings.input_path, settings.output_path); } else { aes::Box box{algorithm, key}; - encrypt_bmp(box, plaintext_path, ciphertext_path); + encrypt_bmp(box, settings.input_path, settings.output_path); } } } @@ -60,11 +57,10 @@ int main(int argc, char** argv) { try { - CommandLineParser cmd_parser(argv[0]); + CommandLineParser cmd_parser{argv[0]}; try { - Settings settings; - cmd_parser.parse(settings, argc, argv); + const auto settings = cmd_parser.parse(argc, argv); if (cmd_parser.exit_with_usage()) { |