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.tomlwithedition = "2024" - Individual problems: Located in
problems/p1/,problems/p2/, etc. Each has its ownCargo.tomlandsrc/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
commoncrate - Problems use dependencies like
hex,base64, andanyhowfor encoding/error handling - Code includes Chinese comments for educational purposes
- The
commoncrate provides utilities for English text validation and XOR operations
Dependencies Pattern
Individual problems typically use:
hexfor hexadecimal encoding/decodingbase64for Base64 operationsanyhowfor error handling (via common crate)- Local
commoncrate for shared utilities
Development Notes
- Each challenge solution should be self-contained in its respective
problems/pN/directory - Use the
commoncrate for shared cryptographic functions - Follow the existing pattern of having a simple
main.rsthat demonstrates the solution