diff --git a/Cargo.toml b/Cargo.toml index d850ce0..f5c2190 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ homepage = "https://github.com/dusk-network/jubjub" license = "MIT/Apache-2.0" name = "dusk-jubjub" repository = "https://github.com/dusk-network/jubjub" -version = "0.8.1" +version = "0.9.0" keywords = ["cryptography", "jubjub", "zk-snarks", "ecc", "elliptic-curve"] categories =["algorithms", "cryptography", "science"] edition = "2018" @@ -19,19 +19,19 @@ exclude = [".github/workflows/ci.yml", "github/workflows/rust.yml", ] [dependencies] -blake2 = "0.9" dusk-bytes = "0.1" -dusk-bls12_381 = {version="0.6", default-features=false} +dusk-bls12_381 = {version="0.7", default-features=false} subtle = {version="^2.3", default-features = false} -rand_core = {version = "0.5", default-features=false} +rand_core = {version = "0.6", default-features=false} canonical = {version = "0.5", optional = true} canonical_derive = {version = "0.5", optional = true} [dev-dependencies] -rand = "0.7" -rand_xorshift = {version="0.2", default-features = false} +rand_xorshift = {version="0.3", default-features = false} +blake2 = "0.9" [features] default = ["std"] std = ["dusk-bls12_381/default"] canon = ["canonical", "canonical_derive", "dusk-bls12_381/canon"] + diff --git a/RELEASES.md b/RELEASES.md index b949e40..69214e3 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,6 +1,16 @@ +# Unreleased + +# 0.9.0 +### Fix +- Fix no_std compatibility for crate.[#67](https://github.com/dusk-network/jubjub/pull/67) + +### Change +- Set `blake2` as dev-dep. [#64](https://github.com/dusk-network/jubjub/issues/64) + + # 0.8.1 ### Change -- Issue #61 - Fix on default-features prop of dusk-bls12_381 dependency +- Fix on default-features prop of dusk-bls12_381 dependency [#61](https://github.com/dusk-network/jubjub/issues/61) # 0.8.0 ### Change diff --git a/src/elgamal.rs b/src/elgamal.rs index fae8045..58a229c 100644 --- a/src/elgamal.rs +++ b/src/elgamal.rs @@ -7,7 +7,7 @@ use dusk_bytes::{DeserializableSlice, Error as BytesError, Serializable}; /// /// ## Example /// -/// ```rust +/// ```ignore /// use dusk_jubjub::elgamal::ElgamalCipher; /// use dusk_jubjub::{JubJubScalar, GENERATOR_EXTENDED}; /// @@ -207,17 +207,20 @@ impl<'b> MulAssign<&'b JubJubScalar> for ElgamalCipher { } } +#[cfg(feature = "std")] #[cfg(test)] mod tests { + use super::ElgamalCipher; use crate::{JubJubExtended, JubJubScalar, GENERATOR_EXTENDED}; use dusk_bytes::Serializable; + use rand_core::OsRng; fn gen() -> (JubJubScalar, JubJubExtended, JubJubScalar, JubJubExtended) { - let a = JubJubScalar::random(&mut rand::thread_rng()); + let a = JubJubScalar::random(&mut OsRng); let a_g = GENERATOR_EXTENDED * a; - let b = JubJubScalar::random(&mut rand::thread_rng()); + let b = JubJubScalar::random(&mut OsRng); let b_g = GENERATOR_EXTENDED * b; (a, a_g, b, b_g) @@ -227,7 +230,7 @@ mod tests { fn encrypt() { let (a, _, b, b_g) = gen(); - let m = JubJubScalar::random(&mut rand::thread_rng()); + let m = JubJubScalar::random(&mut OsRng); let m = GENERATOR_EXTENDED * m; let cipher = ElgamalCipher::encrypt(&a, &b_g, &GENERATOR_EXTENDED, &m); @@ -240,7 +243,7 @@ mod tests { fn wrong_key() { let (a, _, b, b_g) = gen(); - let m = JubJubScalar::random(&mut rand::thread_rng()); + let m = JubJubScalar::random(&mut OsRng); let m = GENERATOR_EXTENDED * m; let cipher = ElgamalCipher::encrypt(&a, &b_g, &GENERATOR_EXTENDED, &m); @@ -257,7 +260,7 @@ mod tests { let mut m = [JubJubScalar::zero(); 4]; m.iter_mut() - .for_each(|x| *x = JubJubScalar::random(&mut rand::thread_rng())); + .for_each(|x| *x = JubJubScalar::random(&mut OsRng)); let mut m_g = [JubJubExtended::default(); 4]; m_g.iter_mut() @@ -287,7 +290,7 @@ mod tests { let mut m = [JubJubScalar::zero(); 4]; m.iter_mut() - .for_each(|x| *x = JubJubScalar::random(&mut rand::thread_rng())); + .for_each(|x| *x = JubJubScalar::random(&mut OsRng)); let mut m_g = [JubJubExtended::default(); 4]; m_g.iter_mut() @@ -317,7 +320,7 @@ mod tests { let mut m = [JubJubScalar::zero(); 4]; m.iter_mut() - .for_each(|x| *x = JubJubScalar::random(&mut rand::thread_rng())); + .for_each(|x| *x = JubJubScalar::random(&mut OsRng)); let mut m_g = [JubJubExtended::default(); 4]; m_g.iter_mut() @@ -343,7 +346,7 @@ mod tests { fn to_bytes() { let (a, _, b, b_g) = gen(); - let m = JubJubScalar::random(&mut rand::thread_rng()); + let m = JubJubScalar::random(&mut OsRng); let m = GENERATOR_EXTENDED * m; let cipher = ElgamalCipher::encrypt(&a, &b_g, &GENERATOR_EXTENDED, &m);