Rust随机数库rand rand_core rand_chacha等

Rust的随机数库如rand/rand_core/rand_chacha等均使用了同一代码库:https://github.com/rust-random/rand/

其中包含了多个库:

  • 1)rand_core:Core traits and error types of the rand library, plus tools for implementing RNGs.
    This crate is intended for use when implementing the core trait, RngCore; it defines the core traits to be implemented as well as several small functions to aid in their implementation and types required for error handling.目前的大部分接口都由rand封装暴露了,可直接调用rand crate。

  • 2)rand_chacha:A cryptographically secure random number generator that uses the ChaCha algorithm.
    ChaCha is a stream cipher designed by Daniel J. Bernstein(ChaCha, a variant of Salsa20), 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(eSTREAM: the ECRYPT Stream Cipher Project).

  • 3)rand_distr: Implements a full suite of random number distributions sampling routines.
    This crate is a super-set of the rand::distributions module, including support for sampling from Beta, Binomial, Cauchy, ChiSquared, Dirichlet, exponential, Fisher F, Gamma, Log-normal, Normal, Pareto, Poisson, StudentT, Triangular and Weibull distributions, as well as sampling points from the unit circle and unit sphere surface.

  • 4)rand_hc: A cryptographically secure random number generator that uses the HC-128 algorithm.
    HC-128 is a stream cipher designed by Hongjun Wu[^1], that we use as an RNG. It is selected as one of the “stream ciphers suitable for widespread adoption” by eSTREAM[^2].

  • 5)rand_isaac: Implements the ISAAC and ISAAC-64 random number generators.
    ISAAC stands for “Indirection, Shift, Accumulate, Add, and Count” which are the principal bitwise operations employed. It is the most advanced of a series of array based random number generator designed by Robert Jenkins in 1996(ISAAC: A fast cryptographic random number generator ISAAC and RC4).
    ISAAC is notably fast and produces excellent quality random numbers for non-cryptographic applications.

  • 6)rand_jitter: Non-physical true random number generator based on timing jitter. 当前不适合用于对密码学安全有要求的场合。
    Note that this RNG is not suited for use cases where cryptographic security is required.

  • 7)rand_os: 即将弃用。在0.5.1版本之后的rand_core中提供了OsRng。A random number generator that retrieves randomness straight from the operating system.

  • 8)rand_pcg: 不适合用于密码学场合,但是具有良好的统计测试性能,内存占用小,运行快等优点。Implements a selection of PCG random number generators. PCG is a family of simple fast space-efficient statistically good algorithms for random number generation. [Melissa O’Neill, Harvey Mudd College, 2014].

  • 9)rand_xorshift: 不适合用于密码学场合,但是运行速度非常快。若不确定是否符合要求,可考虑使用更安全的StdRng或OsRng。mplements the Xorshift random number generator.

  • 10)rand_xoshiro: Rust implementation of the xoshiro, xoroshiro and splitmix64 random number generators.

参考资料:
[1] https://github.com/rust-random/rand/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值