{"id":15370270,"url":"https://github.com/jedisct1/rust-aegis","last_synced_at":"2026-06-01T09:00:35.750Z","repository":{"id":53778132,"uuid":"416731848","full_name":"jedisct1/rust-aegis","owner":"jedisct1","description":"AEGIS high performance ciphers for Rust.","archived":false,"fork":false,"pushed_at":"2026-06-01T07:09:55.000Z","size":3289,"stargazers_count":43,"open_issues_count":0,"forks_count":9,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-06-01T08:25:12.528Z","etag":null,"topics":["aead","aegis","aegis128","aegis128l","aegis256","cipher","crypto"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jedisct1.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-10-13T12:23:31.000Z","updated_at":"2026-06-01T07:09:44.000Z","dependencies_parsed_at":"2025-12-18T20:00:56.637Z","dependency_job_id":null,"html_url":"https://github.com/jedisct1/rust-aegis","commit_stats":{"total_commits":170,"total_committers":2,"mean_commits":85.0,"dds":0.00588235294117645,"last_synced_commit":"74a32d78631bf86f7a9c2536e973566392e86d20"},"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"purl":"pkg:github/jedisct1/rust-aegis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jedisct1%2Frust-aegis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jedisct1%2Frust-aegis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jedisct1%2Frust-aegis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jedisct1%2Frust-aegis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jedisct1","download_url":"https://codeload.github.com/jedisct1/rust-aegis/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jedisct1%2Frust-aegis/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33767437,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-01T02:00:06.963Z","response_time":115,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["aead","aegis","aegis128","aegis128l","aegis256","cipher","crypto"],"created_at":"2024-10-01T13:40:41.003Z","updated_at":"2026-06-01T09:00:35.744Z","avatar_url":"https://github.com/jedisct1.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AEGIS for Rust\n\nThis is a Rust implementation of [AEGIS](https://datatracker.ietf.org/doc/draft-irtf-cfrg-aegis-aead/).\n\nAEGIS is a new family of authenticated encryption algorithms, offering high security and exceptional performance on modern desktop, server, and mobile CPUs.\n\n# [API documentation](https://docs.rs/aegis)\n\n# Cargo flags\n\n- `std`: allow dynamic allocations. This is the default.\n\n- `pure-rust`: don't use the `cc` crate to take advantage of the implementations from [`libaegis`](https://github.com/jedisct1/libaegis). Setting this flag will substantially degrade performance and some features may not be available. When using the pure-rust implementation, adding `RUSTFLAGS=\"-C target-cpu=native\"` to the environment variable prior to compiling the project is highly recommended for better performance.\n\n- `rustcrypto-traits-06`: add traits from `rust-crypto/aead` version 0.6. Alternative interfaces are available in the `compat` namespace.\n\n- `raf`: encrypted random-access file I/O with OS-provided randomness. Requires `std` and the C backend (incompatible with `pure-rust`). See the [RAF section](#random-access-files-raf) below.\n\n- `raf-core`: like `raf` but without `getrandom`. Use this on platforms where OS randomness is unavailable (e.g. freestanding wasm) and supply your own RNG via `RafBuilder::with_rng()`.\n\n- `js`: enables `getrandom` with the `wasm_js` backend for use in `wasm32-unknown-unknown` environments with JavaScript.\n\n# Random Access Files (RAF)\n\nThe `raf` feature exposes an encrypted random-access file API built on top of libaegis. Files are split into independently encrypted chunks, each authenticated with AEAD. Reads and writes at arbitrary byte offsets are supported without decrypting the entire file. An optional Merkle tree provides whole-file integrity verification.\n\n## Supported algorithms\n\nAll six AEGIS variants are available: `Aegis128L`, `Aegis128X2`, `Aegis128X4`, `Aegis256`, `Aegis256X2`, `Aegis256X4`.\n\n## Quick start\n\n```rust,ignore\nuse aegis::raf::{Raf, Aegis256};\n\n// Create a new encrypted file\nlet key = [0u8; 32];\nlet mut f = Raf::\u003cAegis256\u003e::create_file(\"data.raf\", \u0026key).unwrap();\nf.write(b\"hello world\", 0).unwrap();\ndrop(f);\n\n// Open and read back\nlet mut f = Raf::\u003cAegis256\u003e::open_file(\"data.raf\", \u0026key).unwrap();\nlet mut buf = vec![0u8; 11];\nf.read(\u0026mut buf, 0).unwrap();\nassert_eq!(\u0026buf, b\"hello world\");\n```\n\nYou can also use the builder API for more control, or to supply a custom RNG on platforms without OS randomness (e.g. freestanding wasm):\n\n```rust,ignore\nuse aegis::raf::{RafBuilder, Aegis128L, FileIo};\n\nstruct MyRng;\n\nimpl aegis::raf::RafRng for MyRng {\n    fn fill(\u0026mut self, buf: \u0026mut [u8]) -\u003e Result\u003c(), aegis::raf::Error\u003e {\n        // fill buf with random bytes from your source\n        Ok(())\n    }\n}\n\nlet io = FileIo::create(\"data.raf\").unwrap();\nlet key = [0u8; 16];\nlet mut f = RafBuilder::\u003cAegis128L\u003e::with_rng(MyRng)\n    .chunk_size(4096)\n    .truncate(true)\n    .create(io, \u0026key)\n    .unwrap();\n```\n\n## Builder options\n\n`RafBuilder` controls file creation and opening:\n\n- `chunk_size(n)` -- set the chunk size in bytes (default: 65536, only used on create).\n- `truncate(true)` -- truncate the file on create.\n- `rng(r)` -- supply a custom `RafRng` implementation.\n- `merkle(hasher, max_chunks)` -- enable Merkle tree integrity with a custom `MerkleHasher`.\n\n## Operations\n\n`Raf\u003cA\u003e` provides:\n\n- `read(buf, offset)` / `write(data, offset)` -- random-access I/O at any byte offset.\n- `size()` -- current logical file size.\n- `truncate(new_size)` -- shrink the file.\n- `sync()` -- flush to storage.\n- `cursor()` -- returns a `RafCursor` implementing `std::io::Read`, `Write`, and `Seek`.\n- `merkle_rebuild()` / `merkle_verify()` / `merkle_commitment(out)` -- Merkle tree operations (requires Merkle to be enabled via the builder).\n\n## Custom I/O\n\nImplement the `RafIo` trait to use any storage backend:\n\n```rust,ignore\npub trait RafIo {\n    fn read_at(\u0026mut self, buf: \u0026mut [u8], offset: u64) -\u003e std::io::Result\u003c()\u003e;\n    fn write_at(\u0026mut self, buf: \u0026[u8], offset: u64) -\u003e std::io::Result\u003c()\u003e;\n    fn get_size(\u0026mut self) -\u003e std::io::Result\u003cu64\u003e;\n    fn set_size(\u0026mut self, size: u64) -\u003e std::io::Result\u003c()\u003e;\n    fn sync(\u0026mut self) -\u003e std::io::Result\u003c()\u003e { Ok(()) }\n}\n```\n\n`FileIo` is the provided implementation for `std::fs::File`.\n\n## Probing files\n\nTo inspect an encrypted file without opening it:\n\n```rust,ignore\nuse aegis::raf::{self, FileIo};\n\nlet mut io = FileIo::open(\"data.raf\").unwrap();\nlet info = raf::probe(\u0026mut io).unwrap();\nprintln!(\"algorithm: {:?}, chunk_size: {}, file_size: {}\",\n    info.algorithm, info.chunk_size, info.file_size);\n```\n\n## WebAssembly\n\nRAF works on WebAssembly targets:\n\n- Freestanding wasm (`wasm32-unknown-unknown` without JS): use `--features raf-core` and supply a custom `RafRng` via `RafBuilder::with_rng()`.\n- wasm + JavaScript: use `--features raf-core,js` to get `OsRng` backed by `crypto.getRandomValues`.\n- WASI: use `--features raf` for automatic OS-provided randomness.\n\n# Benchmarks\n\nAEGIS is very fast on CPUs with parallel execution pipelines and AES support.\n\nBenchmarks can be reproduced using `export CC=\"clang -O3 -march=native\"` and the `cargo bench` or `cargo-zigbuild bench` commands.\n\nFor performance, `clang` is recommended over `gcc`.\n\n## Encryption (16 KB)\n\n![AEGIS benchmark results](img/bench-encryption.png)\n\n## Authentication (64 KB)\n\n![AEGIS-MAC benchmark results](img/bench-mac.png)\n\n### Mobile benchmarks\n\n![AEGIS mobile benchmark results](img/bench-mobile.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjedisct1%2Frust-aegis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjedisct1%2Frust-aegis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjedisct1%2Frust-aegis/lists"}