1
0
Files
cryptopal_rs/CLAUDE.md
2025-08-27 11:32:48 +08:00

49 lines
2.1 KiB
Markdown

# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
This is a Rust implementation of the Cryptopal challenges - a collection of cryptography exercises. The codebase follows a workspace structure with individual problem solutions and shared utilities.
## Workspace Structure
- **Root workspace**: Defined in `Cargo.toml` with `edition = "2024"`
- **Individual problems**: Located in `problems/p1/`, `problems/p2/`, etc. Each has its own `Cargo.toml` and `src/main.rs`
- **Common utilities**: Located in `common/` crate with shared cryptographic functions like `is_valid_english()` and `xor_with_key()`
- **Documentation**: `cryptopal_book/` contains mdBook documentation for each challenge
## Key Commands
### Building and Running
- `cargo build` - Build the entire workspace
- `cargo run -p p1` - Run a specific problem (e.g., problem 1)
- `cargo build -p p1` - Build a specific problem
- `cargo test` - Run tests across the workspace
- `cargo check` - Quick syntax check without full compilation
### Documentation
- `mdbook build cryptopal_book/` - Build the challenge documentation
- `mdbook serve cryptopal_book/` - Serve documentation locally
## Architecture Notes
- Each problem is isolated in its own binary crate under `problems/`
- Common cryptographic utilities are shared via the `common` crate
- Problems use dependencies like `hex`, `base64`, and `anyhow` for encoding/error handling
- Code includes Chinese comments for educational purposes
- The `common` crate provides utilities for English text validation and XOR operations
## Dependencies Pattern
Individual problems typically use:
- `hex` for hexadecimal encoding/decoding
- `base64` for Base64 operations
- `anyhow` for error handling (via common crate)
- Local `common` crate for shared utilities
## Development Notes
- Each challenge solution should be self-contained in its respective `problems/pN/` directory
- Use the `common` crate for shared cryptographic functions
- Follow the existing pattern of having a simple `main.rs` that demonstrates the solution