feat(cli): add AES to cli app

This commit is contained in:
2025-11-24 11:23:37 +02:00
parent 5b3ca7eacf
commit 051bba33a8
6 changed files with 47 additions and 35 deletions

View File

@@ -1,5 +1,3 @@
use cipher_core::{BlockCipher, InputBlock};
use des::Des;
use std::fmt::Display;
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
@@ -9,16 +7,6 @@ pub enum Algorithm {
Aes,
}
impl Algorithm {
#[must_use]
pub fn get_cipher(&self, key: &impl InputBlock) -> impl BlockCipher {
match self {
Self::Des => Des::from_key(key.as_bytes()),
Self::Aes => todo!("Must implement AES first"),
}
}
}
impl Display for Algorithm {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let s = match self {

View File

@@ -18,9 +18,9 @@ impl OutputFormat {
#[must_use]
pub fn to_string(&self, value: &Output) -> String {
match self {
Self::Binary => format!("{value:064b}"),
Self::Octal => format!("{value:022o}"),
Self::Hex => format!("{value:016X}"),
Self::Binary => format!("{value:b}"),
Self::Octal => format!("{value:o}"),
Self::Hex => format!("{value:X}"),
Self::Text => format!("{value}"),
}
}