Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into alias-method
Browse files Browse the repository at this point in the history
  • Loading branch information
dhardy committed Mar 20, 2020
2 parents 29689f5 + 0c86451 commit 1a23bc8
Show file tree
Hide file tree
Showing 28 changed files with 45 additions and 2,419 deletions.
38 changes: 19 additions & 19 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,28 @@ appveyor = { repository = "rust-random/rand" }

[features]
# Meta-features:
default = ["std"] # without "std" rand uses libcore
default = ["std", "std_rng"]
nightly = ["simd_support"] # enables all features requiring nightly rust
serde1 = [] # does nothing, deprecated

# Optional dependencies:
# Option (enabled by default): without "std" rand uses libcore; this option
# enables functionality expected to be available on a standard platform.
std = ["rand_core/std", "rand_chacha/std", "alloc", "getrandom", "libc"]
alloc = ["rand_core/alloc"] # enables Vec and Box support (without std)
# re-export optional WASM dependencies to avoid breakage:
# Warning: wasm-bindgen and stdweb features will be removed in rand 0.8;
# recommended to activate via the getrandom crate instead.
wasm-bindgen = ["getrandom_package/wasm-bindgen"]
stdweb = ["getrandom_package/stdweb"]
getrandom = ["getrandom_package", "rand_core/getrandom"]

# Configuration:
simd_support = ["packed_simd"] # enables SIMD support
small_rng = ["rand_pcg"] # enables SmallRng
# Option: "alloc" enables support for Vec and Box when not using "std"
alloc = ["rand_core/alloc"]

# Option: use getrandom package for seeding
getrandom = ["rand_core/getrandom"]

# Option (requires nightly): experimental SIMD support
simd_support = ["packed_simd"]

# Option (enabled by default): enable StdRng
std_rng = ["rand_chacha", "rand_hc"]

# Option: enable SmallRng
small_rng = ["rand_pcg"]

[workspace]
members = [
Expand All @@ -47,16 +52,11 @@ members = [
"rand_chacha",
"rand_hc",
"rand_pcg",
"tests/wasm_bindgen",
]

[dependencies]
rand_core = { path = "rand_core", version = "0.5.1" }
rand_pcg = { path = "rand_pcg", version = "0.2", optional = true }
# Do not depend on 'getrandom_package' directly; use the 'getrandom' feature!
# This is a dependency because: we forward wasm feature flags
# This is renamed because: we need getrandom to depend on rand_core/getrandom
getrandom_package = { version = "0.1.1", package = "getrandom", optional = true }
log = { version = "0.4.4", optional = true }

[dependencies.packed_simd]
Expand All @@ -73,9 +73,9 @@ libc = { version = "0.2.22", optional = true, default-features = false }
# Emscripten does not support 128-bit integers, which are used by ChaCha code.
# We work around this by using a different RNG.
[target.'cfg(not(target_os = "emscripten"))'.dependencies]
rand_chacha = { path = "rand_chacha", version = "0.2.1", default-features = false }
rand_chacha = { path = "rand_chacha", version = "0.2.1", default-features = false, optional = true }
[target.'cfg(target_os = "emscripten")'.dependencies]
rand_hc = { path = "rand_hc", version = "0.2" }
rand_hc = { path = "rand_hc", version = "0.2", optional = true }

[dev-dependencies]
rand_pcg = { path = "rand_pcg", version = "0.2" }
Expand Down
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,17 @@ Rand release if required, but the change must be noted in the changelog.
Rand is built with these features enabled by default:

- `std` enables functionality dependent on the `std` lib
- `alloc` (implied by `std`) enables functionality requiring an allocator (when using this feature in `no_std`, Rand requires Rustc version 1.36 or greater)
- `alloc` (implied by `std`) enables functionality requiring an allocator
(when using this feature in `no_std`, Rand requires Rustc version 1.36 or
greater)
- `getrandom` (implied by `std`) is an optional dependency providing the code
behind `rngs::OsRng`
- `std_rng` enables inclusion of `StdRng`, `thread_rng` and `random`
(the latter two *also* require that `std` be enabled)

Optionally, the following dependencies can be enabled:

- `log` enables logging via the `log` crate
- `stdweb` implies `getrandom/stdweb` to enable
`getrandom` support on `wasm32-unknown-unknown`
(will be removed in rand 0.8; activate via `getrandom` crate instead)
- `wasm-bindgen` implies `getrandom/wasm-bindgen` to enable
`getrandom` support on `wasm32-unknown-unknown`
(will be removed in rand 0.8; activate via `getrandom` crate instead)
- `log` enables logging via the `log` crate` crate

Additionally, these features configure Rand:

Expand Down
3 changes: 2 additions & 1 deletion rand_chacha/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.2.2] - 2020-01-20
## [0.2.2] - 2020-03-09
- Integrate `c2-chacha`, reducing dependency count (#931)
- Add CryptoRng to ChaChaXCore (#944)

## [0.2.1] - 2019-07-22
- Force enable the `simd` feature of `c2-chacha` (#845)
Expand Down
2 changes: 2 additions & 0 deletions rand_chacha/src/chacha.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ macro_rules! chacha_impl {
}
}

impl CryptoRng for $ChaChaXCore {}

/// 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
Expand Down
Loading

0 comments on commit 1a23bc8

Please sign in to comment.