Skip to content

Commit

Permalink
Merge pull request #72 from dusk-network/release-0.9
Browse files Browse the repository at this point in the history
Release dusk-jubjub-0.9
  • Loading branch information
CPerezz authored Apr 13, 2021
2 parents 89785b5 + 6a14171 commit 8c4e73c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 16 deletions.
12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"]

12 changes: 11 additions & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
21 changes: 12 additions & 9 deletions src/elgamal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
///
Expand Down Expand Up @@ -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)
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand All @@ -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);
Expand Down

0 comments on commit 8c4e73c

Please sign in to comment.