refactor: rename CLI to crypt and remove ECB terminology
Some checks failed
CI / build-and-test (push) Has been cancelled

This commit is contained in:
Kristofers Solo 2026-01-12 22:12:05 +02:00
parent 4f90912a4d
commit dac009af1b
Signed by: kristoferssolo
GPG Key ID: 8687F2D3EEE6F0ED
3 changed files with 15 additions and 16 deletions

View File

@ -4,8 +4,8 @@ A Rust workspace containing implementations of various cipher algorithms, along
## Features
- **AES Implementation**: AES-128 in ECB and CBC modes
- **DES Implementation**: DES in ECB mode
- **AES Implementation**: AES-128 block cipher and CBC mode
- **DES Implementation**: DES block cipher
- **Command-Line Interface**: Encrypt and decrypt messages or files using the supported ciphers
- **Web Interface**: Browser-based encryption with file upload, drag-and-drop, and random key/IV generation
@ -13,10 +13,10 @@ A Rust workspace containing implementations of various cipher algorithms, along
The `cipher-workshop` workspace is organized into the following crates:
- `aes`: Implementation of the AES cipher (ECB and CBC modes)
- `aes`: Implementation of the AES cipher (block cipher and CBC mode)
- `cipher-core`: Core traits and types for ciphers
- `cipher-factory`: A factory for creating cipher contexts
- `cli`: A command-line interface for the ciphers
- `crypt`: A command-line interface for the ciphers
- `des`: Implementation of the DES cipher
- `web`: A web interface built with Leptos
@ -44,34 +44,34 @@ cargo build
The CLI allows you to encrypt and decrypt messages or files using the supported ciphers.
#### AES (ECB mode)
#### AES (block mode)
```bash
# Encrypt a message
cargo run --bin cli -- encrypt -a aes -k 0x2B7E151628AED2A6ABF7158809CF4F3C "Hello World"
cargo run --bin crypt -- encrypt -a aes -k 0x2B7E151628AED2A6ABF7158809CF4F3C "Hello World"
# Decrypt a message
cargo run --bin cli -- decrypt -a aes -k 0x2B7E151628AED2A6ABF7158809CF4F3C 0x...
cargo run --bin crypt -- decrypt -a aes -k 0x2B7E151628AED2A6ABF7158809CF4F3C 0x...
```
#### AES-CBC (with IV)
```bash
# Encrypt a file
cargo run --bin cli -- encrypt -a aes-cbc -k 0x2B7E151628AED2A6ABF7158809CF4F3C --iv 0x000102030405060708090A0B0C0D0E0F -i input.txt -o output.enc
cargo run --bin crypt -- encrypt -a aes-cbc -k 0x2B7E151628AED2A6ABF7158809CF4F3C --iv 0x000102030405060708090A0B0C0D0E0F -i input.txt -o output.enc
# Decrypt a file
cargo run --bin cli -- decrypt -a aes-cbc -k 0x2B7E151628AED2A6ABF7158809CF4F3C --iv 0x000102030405060708090A0B0C0D0E0F -i output.enc -o decrypted.txt
cargo run --bin crypt -- decrypt -a aes-cbc -k 0x2B7E151628AED2A6ABF7158809CF4F3C --iv 0x000102030405060708090A0B0C0D0E0F -i output.enc -o decrypted.txt
```
#### DES
```bash
# Encrypt a message
cargo run --bin cli -- encrypt -a des -k 0x133457799BBCDFF1 "Hello"
cargo run --bin crypt -- encrypt -a des -k 0x133457799BBCDFF1 "Hello"
# Decrypt a message
cargo run --bin cli -- decrypt -a des -k 0x133457799BBCDFF1 0x...
cargo run --bin crypt -- decrypt -a des -k 0x133457799BBCDFF1 0x...
```
### Web Interface

View File

@ -21,7 +21,7 @@ impl Algorithm {
matches!(self, Self::AesCbc)
}
/// Creates a new ECB-mode cipher instance for the specified algorithm.
/// Creates a new block cipher instance for the specified algorithm.
///
/// Parses the key string and instantiates either DES or AES based on the algorithm choice.
/// The key format depends on the algorithm:
@ -111,7 +111,7 @@ impl Algorithm {
/// - The text length doesn't match the block size
/// - The text contains invalid characters for the given format
///
/// Parses text for ECB-mode algorithms (single block).
/// Parses text for block cipher algorithms (single block).
///
/// For CBC mode, use raw bytes directly instead of this method.
pub fn parse_text(&self, text: &str) -> Result<Vec<u8>, BlockError> {

View File

@ -17,8 +17,7 @@ pub fn Home() -> impl IntoView {
<p>
"A legacy algorithm from the 1970s. While historically significant, "
"it is now considered insecure due to its short 56-bit key length. "
"This tool uses " <strong>"DES-ECB"</strong>
" mode for educational purposes."
"This tool provides DES block encryption for educational purposes."
</p>
</div>
@ -26,7 +25,7 @@ pub fn Home() -> impl IntoView {
<h3>"AES (Advanced Encryption Standard)"</h3>
<p>
"The modern standard for symmetric encryption. This tool offers "
<strong>"AES-128-ECB"</strong> " for single-block operations and "
<strong>"AES-128"</strong> " for single-block operations and "
<strong>"AES-128-CBC"</strong> " for encrypting arbitrary data with "
"PKCS#7 padding."
</p>