chore: update readme

This commit is contained in:
Kristofers Solo 2025-12-31 05:54:29 +02:00
parent 721c712ba3
commit 6acf98bbae
Signed by: kristoferssolo
GPG Key ID: 8687F2D3EEE6F0ED

View File

@ -1,30 +1,31 @@
# Cipher Workshop # Cipher Workshop
This is a Rust workspace containing implementations of various cipher algorithms, along with a command-line interface (CLI) and a web interface to interact with them. A Rust workspace containing implementations of various cipher algorithms, along with a command-line interface (CLI) and a web interface to interact with them.
## Features ## Features
- **AES and DES Implementations**: The workspace includes implementations of the Advanced Encryption Standard (AES) and the Data Encryption Standard (DES). - **AES Implementation**: AES-128 in ECB and CBC modes
- **Command-Line Interface**: A CLI to encrypt and decrypt messages using the supported ciphers. - **DES Implementation**: DES in ECB mode
- **Web Interface**: A web-based interface to perform cipher operations in the browser. - **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
## Workspace Structure ## Workspace Structure
The `cipher-workshop` workspace is organized into the following crates: The `cipher-workshop` workspace is organized into the following crates:
- `aes`: Implementation of the AES cipher. - `aes`: Implementation of the AES cipher (ECB and CBC modes)
- `cipher-core`: Core traits and types for ciphers. - `cipher-core`: Core traits and types for ciphers
- `cipher-factory`: A factory for creating cipher contexts. - `cipher-factory`: A factory for creating cipher contexts
- `cli`: A command-line interface for the ciphers. - `cli`: A command-line interface for the ciphers
- `des`: Implementation of the DES cipher. - `des`: Implementation of the DES cipher
- `web`: A web interface for the ciphers, built with Leptos. - `web`: A web interface built with Leptos
## Getting Started ## Getting Started
### Prerequisites ### Prerequisites
- [Rust](https://www.rust-lang.org/tools/install) - [Rust](https://www.rust-lang.org/tools/install)
- [Trunk](https://trunkrs.dev/#install) (for the web interface) - [cargo-leptos](https://github.com/leptos-rs/cargo-leptos) (for the web interface)
- [Node.js](https://nodejs.org/en/download/) (for end-to-end testing) - [Node.js](https://nodejs.org/en/download/) (for end-to-end testing)
### Building the Project ### Building the Project
@ -41,45 +42,55 @@ cargo build
### CLI ### CLI
The CLI allows you to encrypt and decrypt messages using the supported ciphers. The CLI allows you to encrypt and decrypt messages or files using the supported ciphers.
#### AES #### AES (ECB mode)
To encrypt a message with AES:
```bash ```bash
cargo run --bin cli -- encrypt -a aes -k <KEY> <MESSAGE> # Encrypt a message
cargo run --bin cli -- encrypt -a aes -k 0x2B7E151628AED2A6ABF7158809CF4F3C "Hello World"
# Decrypt a message
cargo run --bin cli -- decrypt -a aes -k 0x2B7E151628AED2A6ABF7158809CF4F3C 0x...
``` ```
To decrypt a message with AES: #### AES-CBC (with IV)
```bash ```bash
cargo run --bin cli -- decrypt -a aes -k <KEY> <MESSAGE> # Encrypt a file
cargo run --bin cli -- 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
``` ```
#### DES #### DES
To encrypt a message with DES:
```bash ```bash
cargo run --bin cli -- encrypt -a des -k <KEY> <MESSAGE> # Encrypt a message
``` cargo run --bin cli -- encrypt -a des -k 0x133457799BBCDFF1 "Hello"
To decrypt a message with DES: # Decrypt a message
cargo run --bin cli -- decrypt -a des -k 0x133457799BBCDFF1 0x...
```bash
cargo run --bin cli -- decrypt -a des -k <KEY> <MESSAGE>
``` ```
### Web Interface ### Web Interface
The web interface provides a user-friendly way to interact with the ciphers, available at: [https://cryptography.kristofers.xyz/](https://cryptography.kristofers.xyz/) The web interface provides a user-friendly way to interact with the ciphers, available at: [https://cryptography.kristofers.xyz/](https://cryptography.kristofers.xyz/)
To run the web interface, navigate to the `web` directory and use `trunk`: Features:
- **DES, AES, and AES-CBC** encryption/decryption
- **Random key and IV generation** using Web Crypto API
- **File upload** with drag-and-drop support
- **File download** for encrypted/decrypted output
- **Multiple output formats**: Hex, Binary, Octal, Text
To run the web interface locally:
```bash ```bash
cd web cd web
trunk serve --open cargo leptos watch
``` ```
## License ## License