lowmc-rs
LowMC Command-Line Interface (CLI)
Build & Install
# Build the CLI binary
# Optionally, install to your $HOME/.cargo/bin
Usage
Generate a new key
- Keys are saved in
~/.lowmc/as<name>.key.
Encrypt a file
- Supported formats:
hex,base64,raw.
Decrypt a file
List all keys
Show key info
Help
Overview
LowMC is a family of block ciphers designed to minimize the number of AND gates in the circuit representation, making it suitable for applications in multi-party computation, fully homomorphic encryption, and zero-knowledge proofs.
This implementation provides:
- Block size: 256 bits
- Key size: 80 bits
- Rounds: 12
- S-boxes per round: 49 (3-bit S-boxes)
- Identity bits per round: 109
Features
- ✅ Complete LowMC implementation following the specification
- ✅ All core cryptographic components (S-box layer, linear layer, key schedule)
- ✅ Matrix inversion and rank checking for full-rank matrices
Usage
Add this to your Cargo.toml:
[]
= "0.1.0"
Basic Usage
use LowMC;
Key Management
use LowMC;
let mut cipher = new;
// Change key
cipher.set_key;
Examples
Run the included example:
Testing
Run the comprehensive test suite:
# Tests must be run in release mode with single thread due to global LFSR state
The test suite includes:
- S-box and inverse S-box verification
- Substitution layer round-trip tests
- Matrix inversion correctness
- Full-rank matrix generation
- Single-round encryption/decryption
- Complete cipher functionality tests
Library Structure
src/lib.rs- Main library implementationsrc/main.rs- Simple binary demoexamples/simple.rs- Comprehensive usage example- Unit tests included in library
Implementation Notes
- Uses custom
BitVecimplementation for efficient bit manipulation - Matrix operations use Gaussian elimination over GF(2)
- All matrices are verified to have full rank before use
Performance
The implementation is optimized for correctness and clarity. For production use in performance-critical applications, consider:
- Using fixed precomputed matrices instead of random generation
- Batch processing multiple blocks
- Platform-specific optimizations
License
Licensed under either of:
- Apache License, Version 2.0
- MIT License
at your option.
References
Status
This implementation successfully passes all cryptographic component tests. The core algorithm structure is mathematically sound and follows the LowMC specification exactly.