feat: add cli app

This commit is contained in:
2025-10-06 11:49:27 +03:00
parent 20ff162d71
commit 93696b5d68
7 changed files with 485 additions and 13 deletions

21
des/src/main.rs Normal file
View File

@@ -0,0 +1,21 @@
mod args;
use crate::args::{Args, Operation};
use clap::Parser;
use des_lib::Des;
fn main() {
let args = Args::parse();
let des = Des::new(args.key.as_64());
match args.operation {
Operation::Encrypt => {
let ciphertext = des.encrypt(args.text.as_64());
println!("{ciphertext:016X}");
}
Operation::Decrypt { output_format } => {
let plaintext = des.decrypt(args.text.as_64());
println!("{plaintext:016X}");
}
}
}