{"id":33936682,"url":"https://github.com/5n00py/soft-aes","last_synced_at":"2026-04-02T01:31:12.201Z","repository":{"id":211972216,"uuid":"729470432","full_name":"5n00py/soft-aes","owner":"5n00py","description":"Software implementation of the AES cipher with related modes of operations","archived":false,"fork":false,"pushed_at":"2024-02-05T15:43:20.000Z","size":111,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-02T11:10:04.292Z","etag":null,"topics":["aes","aes-128","aes-192","aes-256","aes-cbc","aes-cmac","aes-ecb","cryptography","cryptography-library","cybersecurity","pkcs7","rust-crypto","rust-cryptography-library"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/5n00py.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-12-09T10:36:23.000Z","updated_at":"2024-07-31T10:18:43.000Z","dependencies_parsed_at":"2023-12-11T22:19:20.446Z","dependency_job_id":"4150bd33-ded8-4d7c-872b-9eafdb523ec3","html_url":"https://github.com/5n00py/soft-aes","commit_stats":null,"previous_names":["5n00py/soft-aes"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/5n00py/soft-aes","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5n00py%2Fsoft-aes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5n00py%2Fsoft-aes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5n00py%2Fsoft-aes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5n00py%2Fsoft-aes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/5n00py","download_url":"https://codeload.github.com/5n00py/soft-aes/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/5n00py%2Fsoft-aes/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31293918,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T01:05:07.454Z","status":"ssl_error","status_checked_at":"2026-04-02T00:56:46.496Z","response_time":53,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aes","aes-128","aes-192","aes-256","aes-cbc","aes-cmac","aes-ecb","cryptography","cryptography-library","cybersecurity","pkcs7","rust-crypto","rust-cryptography-library"],"created_at":"2025-12-12T14:29:30.172Z","updated_at":"2026-04-02T01:31:12.193Z","avatar_url":"https://github.com/5n00py.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Soft-AES: A Software-Based Functional AES Library in Rust\n\n**Soft-AES** is a Rust library offering a software-based implementation of the\nAdvanced Encryption Standard (AES) algorithm, distinct from hardware-based\nsolutions. It provides AES encryption and decryption in Electronic Codebook\n(ECB) and Cipher Block Chaining (CBC) modes and an integrated Cipher-based\nMessage Authentication Code (AES-CMAC) calculation.\n\nThe library includes support for PKCS#7 padding and `0x80` padding (ISO/IEC\n9797-1 Padding Method 2).\n\nAES functionalities in Soft-AES are implemented using a functional approach, as\nopposed to instance-based approaches. By employing lookup tables for critical\nAES operations, the library achieves a balance between simplicity and\nperformance.\n\n**HAZMAT!** It's important to recognize that this implementation does not\ncurrently incorporate defenses against side-channel attacks. Consequently,\nSoft-AES is optimally suited for educational purposes and non-critical\napplication scenarios like testing where advanced protections are not a primary\nconcern.\n\n## Table of Contents\n\n- [Features](#features)\n- [Usage](#usage)\n  - [AES ECB Mode](#aes-ecb-mode)\n  - [AES CBC Mode](#aes-cbc-mode)\n  - [AES CMAC](#aes-cmac)\n  - [PKCS#7 Padding](#pkcs7-padding)\n- [Testing](#testing)\n  - [Current NIST Test Coverage](#current-nist-test-coverage)\n  - [Core Unit Tests](#core-unit-tests)\n  - [Future Test Expansion](#future-test-expansion)\n- [Disclaimer](#disclaimer)\n- [Official Standard References](#official-standard-references)\n- [Acknowledgments](#acknowledgments)\n- [Related Projects](#related-projects)\n  - [soft-aes-wasm](#soft-aes-wasm)\n  - [Web UI for AES Encryption/Decryption](#web-ui-for-aes-encryptiondecryption)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Features\n\n- **AES Core:** Core implementations for encryption and decryption processes of\n  a single block, including SubBytes, ShiftRows, MixColumns, and their\n  inverses.\n- **ECB Mode:** Simple block-wise encryption and decryption without chaining.\n- **CBC Mode:** Improved block-wise encryption and decryption with\n  Initialization Vector (IV) based chaining.\n- **AES-CMAC:** Message authentication capabilities based on AES-128, AES-192\n  and AES-256.\n- **PKCS#7 Padding:** Support for PKCS#7 padding scheme to ensure uniform block\n  sizes.\n- **0x80 Padding:** Support for `0x80` padding (ISO/IEC 9797-1 Padding Method\n  2).\n\n## Usage\n\nTo use `soft-aes` in your Rust project, add it as a dependency in your\n`Cargo.toml` file:\n\n```toml\n[dependencies]\nsoft-aes = \"0.2.0\"\n```\n\nThis library is designed for straightforward integration into cryptographic\napplications, especially those requiring AES encryption and decryption. Below\nare basic usage examples for different components of the library.\n\n### AES ECB Mode\n\n```rust \nuse soft_aes::aes::{aes_enc_ecb, aes_dec_ecb};\n\nlet plaintext = b\"Example plaintext.\"; \nlet key = b\"Very secret key.\"; \nlet padding = Some(\"PKCS7\");\n\nlet encrypted = aes_enc_ecb(plaintext, key, padding).expect(\"Encryption failed\");\nlet decrypted = aes_dec_ecb(\u0026encrypted, key, padding).expect(\"Decryption failed\");\n\nassert_eq!(decrypted, plaintext);\n```\n\n### AES CBC Mode\n\n```rust\nuse soft_aes::aes::{aes_enc_cbc, aes_dec_cbc};\n\nlet plaintext = b\"Example plaintext.\";\nlet key = b\"Very secret key.\";\nlet iv = b\"Random Init Vec.\";\nlet padding = Some(\"PKCS7\");\n\nlet encrypted = aes_enc_cbc(plaintext, key, iv, padding).expect(\"Encryption failed\");\nlet decrypted = aes_dec_cbc(\u0026encrypted, key, iv, padding).expect(\"Decryption failed\");\n\nassert_eq!(decrypted, plaintext);\n```\n\n### AES CMAC \n\n```rust\nuse soft_aes::aes::aes_cmac;\nuse hex::decode as hex_decode;\n\nlet key = hex_decode(\"603DEB1015CA71BE2B73AEF0857D77811F352C073B6108D72D9810A30914DFF4\").unwrap();\nlet message = hex_decode(\"6BC1BEE22E409F96E93D7E117393172AAE2D8A57\").unwrap();\nlet mac = aes_cmac(\u0026message, \u0026key).unwrap();\n\nassert_eq!(\n    mac.to_vec(),\n    hex_decode(\"156727DC0878944A023C1FE03BAD6D93\").unwrap()\n);\n```\n\n### PKCS#7 Padding\n\n```rust\nuse soft_aes::padding::{pkcs7_pad, pkcs7_unpad};\n\nlet mut data = vec![0x01, 0x02, 0x03];\nlet block_size = 8;\npkcs7_pad(\u0026mut data, block_size).expect(\"Padding failed\");\nassert_eq!(data, vec![0x01, 0x02, 0x03, 0x05, 0x05, 0x05, 0x05, 0x05]);\n\npkcs7_unpad(\u0026mut data).expect(\"Unpadding failed\");\nassert_eq!(data, vec![0x01, 0x02, 0x03]);\n```\n\n## Testing\n\nThe Soft-AES library includes comprehensive testing against the National\nInstitute of Standards and Technology (NIST) Advanced Encryption Standard\nAlgorithm Validation Suite (AESAVS) for ECB mode and additional test vectors.\n\n### Current NIST Test Coverage\n\n- **AES ECB Mode Validation:** Extensive coverage utilizing Known Answer Tests\n  (KAT) from the AESAVS for various key sizes.\n\n### Core Unit Tests\n\nAdditional tests using test vectors from CryptoTool's Online AES Step-by-Step\nTool.\n\n### Future Test Expansion\n\nPlans to expand test coverage for other AES modes and additional test\nscenarios.\n\n## Disclaimer\n\n- **ECB Mode Limitations:** The ECB mode of AES does not ensure confidentiality\n  for data with recognizable patterns.\n- **CBC Mode Considerations:** While AES CBC mode enhances security, it\n  requires careful management of the Initialization Vector (IV).\n- **Cryptographic Randomness and Key Management:** The library does not include\n  its own cryptographic random number generators or manage cryptographic\n  keys.\n- **No Protection Against Side-Channel Attacks:** Intended primarily for\n  educational use and non-critical applications.\n- **\"As Is\" Provision:** The library is provided \"as is,\" without any\n  warranty.\n\n## Official Standard References\n\n- AES is defined in [FIPS PUB 197](https://csrc.nist.gov/pubs/fips/197/final).\n\n- AES-CMAC is defined in [RFC 4493](https://www.rfc-editor.org/rfc/rfc4493).\n\n- AES-CMAC for different key lengths is defined in [NIST SP\n  800-38B](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-38b.pdf).\n\n- PKCS#7 padding is defined in [RFC\n  2315](https://www.rfc-editor.org/rfc/rfc2315).\n\n- 0x80 padding is defined in [ISO/IEC 9797-1 padding method\n  2](https://www.iso.org/standard/50375.html).\n\n## Acknowledgments\n\nThe development of the Soft-AES library is a culmination of knowledge,\nresources, and tools that have significantly influenced its design and\nimplementation.\n\nThe Rust implementation of Soft-AES is fundamentally based on a C\nimplementation I implemented during my studies, primarily guided by the book\n\"The Design of Rijndael\" and its reference code. The updated insights from \"The\nDesign of Rijndael: AES - The Advanced Encryption Standard\" by Joan Daemen and\nVincent Rijmen.\n\nAdditionally, AI assistance was utilized for documenting, commenting, and\ntroubleshooting various aspects of the library and\n[SmartCommit](https://github.com/5n00py/SmartCommit) served as commit\nassistant.\n\n## Related Projects\n\n### soft-aes-wasm \n\n[soft-aes-wasm](https://github.com/5n00py/soft-aes-wasm) is a\ncompanion project that extends the functionality of the `Soft-AES` library to\nWebAssembly (Wasm). This project enables AES encryption and\ndecryption directly in web applications by providing a Wasm interface for\n`Soft-AES`.\n\n### Web UI \n\nFor a practical and user-friendly implementation of AES directly in the\nbrowser, visit [AES-Wasm Tool](https://jointech.at/tools/aes-wasm/index.html).\nThis web tool based on `soft-aes-wasm` library provides a convenient solution\nfor performing AES encryption and decryption tests in the browser.\n\n## License\n\nCopyright David Schmid (david.schmid@mailbox.org)\n\nThe binaries are distributed under the terms of the GNU General Public License\nVersion 3 (GPLv3), as detailed in the [LICENSE](LICENSE) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F5n00py%2Fsoft-aes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F5n00py%2Fsoft-aes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F5n00py%2Fsoft-aes/lists"}