2.1 KiB
2.1 KiB
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
withedition = "2024"
- Individual problems: Located in
problems/p1/
,problems/p2/
, etc. Each has its ownCargo.toml
andsrc/main.rs
- Common utilities: Located in
common/
crate with shared cryptographic functions likeis_valid_english()
andxor_with_key()
- Documentation:
cryptopal_book/
contains mdBook documentation for each challenge
Key Commands
Building and Running
cargo build
- Build the entire workspacecargo run -p p1
- Run a specific problem (e.g., problem 1)cargo build -p p1
- Build a specific problemcargo test
- Run tests across the workspacecargo check
- Quick syntax check without full compilation
Documentation
mdbook build cryptopal_book/
- Build the challenge documentationmdbook 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
, andanyhow
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/decodingbase64
for Base64 operationsanyhow
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