From f874d292384962b6b194ca4d48b39ca485e379bd Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Wed, 22 Dec 2021 05:15:06 +0000 Subject: [PATCH] Remove `FieldExt::rand` This removes a dependency on the `getrandom` crate in no-std mode, which doesn't work on some no-std targets that `getrandom` doesn't support. --- CHANGELOG.md | 1 + Cargo.toml | 2 +- src/arithmetic/fields.rs | 5 ----- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d5df23a..768dde2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to Rust's notion of - `FieldExt::from_u64` (use `From for ff::PrimeField` instead). - `FieldExt::{from_bytes, read, to_bytes, write}` (use `ff::PrimeField::{from_repr, to_repr}` instead). + - `FieldExt::rand` (use `ff::Field::random` instead). ## [0.2.1] - 2021-09-17 ### Changed diff --git a/Cargo.toml b/Cargo.toml index db355e1..bbbe635 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -44,7 +44,7 @@ required-features = ["std"] blake2b_simd = { version = "0.5", default-features = false } ff = { version = "0.11", default-features = false } group = { version = "0.11", default-features = false } -rand = { version = "0.8", default-features = false, features = ["getrandom"] } +rand = { version = "0.8", default-features = false } static_assertions = "1.1.0" subtle = { version = "2.3", default-features = false } diff --git a/src/arithmetic/fields.rs b/src/arithmetic/fields.rs index c44f46a..ab3a1c2 100644 --- a/src/arithmetic/fields.rs +++ b/src/arithmetic/fields.rs @@ -112,11 +112,6 @@ pub trait FieldExt: SqrtRatio + From + Ord + Group { /// Element of multiplicative order $3$. const ZETA: Self; - /// This computes a random element of the field using system randomness. - fn rand() -> Self { - Self::random(rand::rngs::OsRng) - } - /// Obtains a field element congruent to the integer `v`. fn from_u128(v: u128) -> Self;