From dd07a1d29b38068eaf1e0ed9ba26f98f1c2e822c Mon Sep 17 00:00:00 2001 From: Kristofers Solo Date: Wed, 31 Dec 2025 00:18:24 +0200 Subject: [PATCH] docs(aes,des): add crate documentation and improve re-exports Add crate-level doc comments with usage examples. Export additional types for library users: - aes: Block32 (32-bit word type) - des: LR (Feistel round state) --- aes/src/lib.rs | 15 ++++++++++++++- des/src/lib.rs | 16 +++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/aes/src/lib.rs b/aes/src/lib.rs index fabc0e8..9c9d2fd 100644 --- a/aes/src/lib.rs +++ b/aes/src/lib.rs @@ -1,3 +1,16 @@ +//! AES (Advanced Encryption Standard) implementation. +//! +//! Provides AES-128 block cipher with 128-bit keys and blocks. +//! +//! # Example +//! ``` +//! use aes::Aes; +//! use cipher_core::BlockCipher; +//! +//! let cipher = Aes::new(0x2b7e1516_28aed2a6_abf71588_09cf4f3c_u128); +//! let ciphertext = cipher.encrypt(&[0u8; 16]).unwrap(); +//! ``` + mod aes; mod block; mod constants; @@ -5,4 +18,4 @@ mod key; mod operations; mod sbox; -pub use {aes::Aes, block::Block128}; +pub use {aes::Aes, block::Block128, block::Block32}; diff --git a/des/src/lib.rs b/des/src/lib.rs index 2857a60..85f157d 100644 --- a/des/src/lib.rs +++ b/des/src/lib.rs @@ -1,7 +1,21 @@ +//! DES (Data Encryption Standard) implementation. +//! +//! Provides the classic DES block cipher with 64-bit keys and blocks. +//! Uses 16 Feistel rounds with 48-bit subkeys. +//! +//! # Example +//! ``` +//! use des::Des; +//! use cipher_core::BlockCipher; +//! +//! let cipher = Des::new(0x133457799BBCDFF1_u64); +//! let ciphertext = cipher.encrypt(&[0u8; 8]).unwrap(); +//! ``` + mod block; pub mod constants; mod des; mod key; pub mod utils; -pub use {block::Block64, des::Des}; +pub use {block::Block64, block::LR, des::Des};