{"id":18519996,"url":"https://github.com/tf-encrypted/aes-prng","last_synced_at":"2025-07-20T13:35:53.856Z","repository":{"id":62444498,"uuid":"496169187","full_name":"tf-encrypted/aes-prng","owner":"tf-encrypted","description":"Rust pseudo-random number generator based on AES","archived":false,"fork":false,"pushed_at":"2024-02-15T08:39:43.000Z","size":37,"stargazers_count":6,"open_issues_count":3,"forks_count":2,"subscribers_count":13,"default_branch":"main","last_synced_at":"2024-03-15T11:49:18.067Z","etag":null,"topics":["aes","cryptography","prng","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tf-encrypted.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}},"created_at":"2022-05-25T09:41:02.000Z","updated_at":"2024-04-20T06:37:13.520Z","dependencies_parsed_at":"2024-02-15T09:48:16.169Z","dependency_job_id":null,"html_url":"https://github.com/tf-encrypted/aes-prng","commit_stats":{"total_commits":18,"total_committers":2,"mean_commits":9.0,"dds":"0.16666666666666663","last_synced_commit":"d0492cf65f69252d2754e84d03b5d5b32c289afa"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tf-encrypted%2Faes-prng","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tf-encrypted%2Faes-prng/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tf-encrypted%2Faes-prng/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tf-encrypted%2Faes-prng/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tf-encrypted","download_url":"https://codeload.github.com/tf-encrypted/aes-prng/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248012592,"owners_count":21033226,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","cryptography","prng","rust"],"created_at":"2024-11-06T17:18:14.646Z","updated_at":"2025-07-20T13:35:53.849Z","avatar_url":"https://github.com/tf-encrypted.png","language":"Rust","funding_links":[],"categories":["Software"],"sub_categories":["Primitives"],"readme":"# AES-PRNG\n\n[![crate][crate-image]][crate-link]\n[![Docs][docs-image]][docs-link]\n[![Build Status][build-image]][build-link]\n[![Apache2 License 2.0][license-image]][license-link]\n[![Minimum rustc version][rustc-image]][rustc-link]\n[![Downloads][downloads-image]][crate-link]\n\nA Rust library for random number generation using AES as the underlying block-cipher.\n\n## Usage\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\naes-prng = \"0.2.2\"\n```\n\n## Example\n\n```rust\nuse rand::{RngCore, SeedableRng};\nuse aes_prng::AesRng;\n\nlet mut rng = AesRng::from_random_seed();\n\n// sample random bytes\nlet mut bytes = [0; 1024];\nrng.fill_bytes(\u0026mut bytes);\n\n// sample random u32\nlet r_u32 = rng.next_u32();\n\n// sample random u64\nlet r_u64 = rng.next_u64();\n```\n\n`AesRng` can also be created from an existing seed:\n\n```rust\nlet seed = AesRng::generate_random_seed();\nlet mut rng = AesRng::from_seed(seed);\n```\n\n### Rust version requirements\n\nAES-PRNG requires **Rustc version 1.56 or greater** due to the [RustCrypto](\nhttps://github.com/RustCrypto/block-ciphers/tree/master/aes) dependency.\n\n## Crate Features\n\nAES-PRNG is built with the `-Ctarget-feature=+aes` feature enabled by default\nto get the benefit of AES-NI instructions for speeding up the PRNG calls.\n\n## Benchmarks\n\n### AMD Ryzen 9 3900X\n\n```\n$ cargo bench -- rng_fill\n\nrng_fill/chacha8/100    time:   [18.266 us 18.269 us 18.271 us]\nrng_fill/chacha12/100   time:   [24.603 us 24.607 us 24.610 us]\nrng_fill/chacha20/100   time:   [38.965 us 38.970 us 38.974 us]\nrng_fill/aes/100        time:   [24.080 us 24.113 us 24.144 us]\n\nrng_fill/chacha8/1000   time:   [176.70 us 176.71 us 176.73 us]\nrng_fill/chacha12/1000  time:   [248.39 us 248.41 us 248.44 us]\nrng_fill/chacha20/1000  time:   [391.49 us 391.68 us 391.90 us]\nrng_fill/aes/1000       time:   [225.52 us 225.53 us 225.54 us]\n```\n\n### Apple M1 Max\n\n```\n$ cargo bench -- rng_fill\n\nrng_fill/chacha8/100    time:   [82.938 us 83.033 us 83.144 us]\nrng_fill/chacha12/100   time:   [120.63 us 120.84 us 121.05 us]\nrng_fill/chacha20/100   time:   [195.85 us 196.17 us 196.51 us]\nrng_fill/aes/100        time:   [414.90 us 415.26 us 415.71 us]\n\nrng_fill/chacha8/1000   time:   [833.53 us 834.31 us 835.25 us]\nrng_fill/chacha12/1000  time:   [1.2083 ms 1.2093 ms 1.2106 ms]\nrng_fill/chacha20/1000  time:   [1.9600 ms 1.9638 ms 1.9685 ms]\nrng_fill/aes/1000       time:   [4.1675 ms 4.1731 ms 4.1792 ms]\n```\n\n```\n$ RUSTUP_TOOLCHAIN=nightly \\\n  RUSTFLAGS=\"--cfg aes_armv8\" \\\n  cargo bench -- rng_fill\n\nrng_fill/chacha8/100    time:   [74.994 us 75.104 us 75.223 us]\nrng_fill/chacha12/100   time:   [109.58 us 109.75 us 109.95 us]\nrng_fill/chacha20/100   time:   [179.29 us 179.52 us 179.79 us]\nrng_fill/aes/100        time:   [11.019 us 11.064 us 11.113 us]\n\nrng_fill/chacha8/1000   time:   [751.56 us 752.02 us 752.55 us]\nrng_fill/chacha12/1000  time:   [1.1022 ms 1.1036 ms 1.1054 ms]\nrng_fill/chacha20/1000  time:   [1.8051 ms 1.8100 ms 1.8157 ms]\nrng_fill/aes/1000       time:   [112.58 us 113.03 us 113.49 us]\n```\n\n## Releasing\n\nWe release manually using [`carge-release`](https://github.com/crate-ci/cargo-release):\n\n```\n$ cargo release minor\n```\n\n## License\n\nAES-PRNG is distributed under the terms of Apache License (Version 2.0). Copyright as specified in [NOTICE](./NOTICE).\n\n\n[//]: # (badges)\n\n\n[crate-image]: https://img.shields.io/crates/v/aes-prng.svg\n[crate-link]: https://crates.io/crates/aes-prng\n[docs-image]: https://docs.rs/aes-prng/badge.svg\n[docs-link]: https://docs.rs/aes-prng\n[build-image]: https://github.com/tf-encrypted/aes-prng/workflows/CI/badge.svg\n[build-link]: https://github.com/tf-encrypted/aes-prng/actions\n[license-image]: https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat\n[license-link]: https://www.apache.org/licenses/LICENSE-2.0\n[rustc-image]: https://img.shields.io/badge/rustc-1.56+-blue.svg\n[rustc-link]: https://github.com/tf-encrypted/aes-prng#rust-version-requirements\n[downloads-image]: https://img.shields.io/crates/d/aes-prng.svg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftf-encrypted%2Faes-prng","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftf-encrypted%2Faes-prng","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftf-encrypted%2Faes-prng/lists"}