Add a new format version (2) for encrypted text.
[rup.git] / src / main.rs
index 1d25a69..8d0a5c9 100644 (file)
@@ -127,7 +127,8 @@ fn process_args(key: &str) -> bool {
     } else if let Some((position_arg_encrypt, _)) = args.iter().find_position(|arg| arg == &"--encrypt") {
         match args.get(position_arg_encrypt + 1) {
             Some(mess_to_encrypt) => {
-                match crypto::encrypt(&key, mess_to_encrypt) {
+                // Encrypt to version 2 (version 1 is obsolete).
+                match crypto::encrypt(&key, mess_to_encrypt, 2) {
                     Ok(encrypted_mess) => {
                         let encrypted_mess_encoded = percent_encoding::utf8_percent_encode(&encrypted_mess, percent_encoding::NON_ALPHANUMERIC).to_string();
                         println!("Encrypted message percent-encoded: {}", encrypted_mess_encoded); },