9 releases

0.9.0-alpha.1 Mar 18, 2024
0.3.1 Jun 9, 2021
0.3.0 Dec 14, 2020
0.2.2 Mar 10, 2020
0.1.0 Oct 17, 2018

#157 in Algorithms

Download history 1994235/week @ 2024-01-03 2077629/week @ 2024-01-10 2273483/week @ 2024-01-17 2201229/week @ 2024-01-24 2282282/week @ 2024-01-31 2266149/week @ 2024-02-07 2264471/week @ 2024-02-14 2395031/week @ 2024-02-21 2429696/week @ 2024-02-28 2359510/week @ 2024-03-06 2314700/week @ 2024-03-13 2422916/week @ 2024-03-20 2283251/week @ 2024-03-27 2424932/week @ 2024-04-03 2385623/week @ 2024-04-10 1970108/week @ 2024-04-17

9,513,903 downloads per month
Used in 16,121 crates (664 directly)

MIT/Apache

105KB
1.5K SLoC

rand_chacha

Test Status Latest version Book API API Minimum rustc version

A cryptographically secure random number generator that uses the ChaCha algorithm.

ChaCha is a stream cipher designed by Daniel J. Bernstein[^1], that we use as an RNG. It is an improved variant of the Salsa20 cipher family, which was selected as one of the "stream ciphers suitable for widespread adoption" by eSTREAM[^2].

The RNGs provided by this crate are implemented via the fast stream ciphers of the c2-chacha crate.

Links:

[^1]: D. J. Bernstein, ChaCha, a variant of Salsa20

[^2]: eSTREAM: the ECRYPT Stream Cipher Project

Crate Features

rand_chacha is no_std compatible when disabling default features; the std feature can be explicitly required to re-enable std support. Using std allows detection of CPU features and thus better optimisation. Using std also enables getrandom functionality, such as ChaCha20Rng::from_entropy().

License

rand_chacha is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT, and COPYRIGHT for details.

Dependencies

~0.7–1MB
~17K SLoC