Magma
Symmetric Key Block Cipher "Magma" in Rust
Install / Use
/learn @sheroz/MagmaREADME
Symmetric Key Block Cipher "Magma" in Rust
The brief description: https://sheroz.com/pages/blog/rust-cipher-magma-28147-89.html
Supported Cipher Modes
- ECB - Electronic Codebook Mode
- CTR - Counter Encryption Mode
- CTR-ACPKM - Counter Encryption Mode as per RFC8645
- OFB - Output Feedback Mode
- CBC - Cipher Block Chaining Mode
- CFB - Cipher Feedback Mode
- MAC - Message Authentication Code Generation Mode
Implemented and tested according to specifications
- RFC 8891 a.k.a GOST R 34.12-2015: Block Cipher "Magma"
- RFC 5830 a.k.a GOST 28147-89
- Block Cipher Modes:
Tests are implemented using: crypto_vectors
Tested on platforms
- Linux Ubuntu 22.04 LTS / Intel® Core™ i7
- MacOS Ventura 13.4 / Apple Macbook Pro M1
Usage
Please look at magma_samples
Samples
- Block encryption encrypt_block.rs
- Text encryption encrypt_text.rs
- Message Authentication Code (MAC) calculate_mac.rs
- Buffer encryption encrypt_buffer.rs
- Buffer encryption by parallel processing encrypt_buffer_parallel.rs
- On a MacBook M1 Pro with 8+2 cores, the encryption speed increased ~ 8.3 times
- On an i7-3770 with 4 cores, running Linux, the encryption speed increased ~ 4.5 times
- File encryption encrypt_file.rs
- Bitmap file encryption encrypt_bmp.rs
Bitmap file encryption results
The original bitmap image: Ferris the crab
Encrypted bitmap in Electronic Codebook (ECB) Mode
Please note that the ECB mode has weaknesses. It does not hide data patterns well and leaks information about the plaintext. ECB mode is not recommended for use in cryptographic protocols.
Encrypted bitmap in Counter Encryption (CTR) Mode
Encrypted bitmap in Output Feedback (OFB) Mode
Encrypted bitmap in Cipher Block Chaining (CBC) Mode
Encrypted bitmap in Cipher Feedback (CFB) Mode
Disclaimer
This project was created for research purposes and is not intended for use in production systems.
Related Skills
node-connect
341.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.5kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
341.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.5kCommit, push, and open a PR






