Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip: move rand_core requirement under std feature flag #100

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,6 @@
* add power impl and expose `Fq::from_montgomery_limbs` by @redshiftzero in #98
* Add missing conversion trait implementations by @neithanmo in #97

# 0.10.0

* Move random sampling methods under `std` feature by @redshiftzero in #100
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "decaf377"
version = "0.9.0"
version = "0.10.0"
authors = [
"Henry de Valence <[email protected]>",
"redshiftzero <[email protected]>",
Expand All @@ -16,7 +16,7 @@ license = "MIT OR Apache-2.0"
cfg-if = "1.0"
hex = { version = "=0.4.3", default-features = false }
subtle = { version = "2.5", default-features = false }
rand_core = { version = "0.6", default-features = false }
rand_core = { version = "0.6", default-features = false, optional=true }
zeroize = { version = "1.7", default-features = false }
# no-std
num-bigint = { version = "0.4.4", optional = true, default-features = false }
Expand Down
2 changes: 2 additions & 0 deletions src/fields/fp.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use cfg_if::cfg_if;
#[cfg(feature = "std")]
use rand_core::CryptoRngCore;

use crate::EncodingError;
Expand Down Expand Up @@ -130,6 +131,7 @@ impl Fp {
self.to_bytes_le()
}

#[cfg(feature = "std")]
/// Sample a random field element uniformly.
pub fn rand<R: CryptoRngCore>(rng: &mut R) -> Self {
// Sample wide, reduce
Expand Down
2 changes: 2 additions & 0 deletions src/fields/fq.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use cfg_if::cfg_if;
#[cfg(feature = "std")]
use rand_core::CryptoRngCore;

use crate::EncodingError;
Expand Down Expand Up @@ -115,6 +116,7 @@ impl Fq {
self.to_bytes_le()
}

#[cfg(feature = "std")]
/// Sample a random field element uniformly.
pub fn rand<R: CryptoRngCore>(rng: &mut R) -> Self {
// Sample wide, reduce
Expand Down
2 changes: 2 additions & 0 deletions src/fields/fr.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use cfg_if::cfg_if;
#[cfg(feature = "std")]
use rand_core::CryptoRngCore;

use crate::EncodingError;
Expand Down Expand Up @@ -107,6 +108,7 @@ impl Fr {
self.to_bytes_le()
}

#[cfg(feature = "std")]
/// Sample a random field element uniformly.
pub fn rand<R: CryptoRngCore>(rng: &mut R) -> Self {
// Sample wide, reduce
Expand Down
Loading