Skip to content
Merged
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
20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "ark-vrf"
version = "0.1.0"
edition = "2021"
edition = "2024"
authors = [ "Davide Galassi <davxy@datawok.net>" ]
license = "MIT"
description = "Elliptic curve VRF with additional data"
Expand All @@ -19,7 +19,7 @@ sha2 = { version = "0.10", default-features = false }
rand_chacha = { version = "0.3", default-features = false }
rayon = { version = "1.10", default-features = false, optional = true }
hmac = {version = "0.12", default-features = false, optional = true }
ring-proof = { package = "w3f-ring-proof", version = "0.0.2", default-features = false, optional = true }
w3f-ring-proof = { version = "0.0.2", default-features = false, optional = true }
# Curves
ark-secp256r1 = { version = "0.5", default-features = false, optional = true }
ark-ed25519 = { version = "0.5", default-features = false, optional = true }
Expand All @@ -31,18 +31,18 @@ ark-bn254 = { version = "0.5", default-features = false, optional = true }

[dev-dependencies]
ark-std = { version = "0.5", default-features = false, features = ["getrandom"] }
ark-ed25519 = "0.5"
hex = "0.4"
ark-ed25519 = { version = "0.5" }
hex = { version = "0.4" }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_json = { version = "1.0" }
indexmap = { version = "2.2.6", features = ["serde"] }

[features]
default = [ "std" ]
std = [
"ark-std/std",
"ark-ec/std",
"ring-proof?/std",
"w3f-ring-proof?/std",
]
secret-split = [ "ark-std/getrandom" ]
full = [
Expand All @@ -60,19 +60,19 @@ bandersnatch = [ "ark-ed-on-bls12-381-bandersnatch", "ark-bls12-381/curve" ]
baby-jubjub = [ "ark-ed-on-bn254", "ark-bn254/curve" ]
secp256r1 = [ "ark-secp256r1", "rfc-6979" ]
# Miscellanea
ring = [ "ring-proof" ]
ring = [ "w3f-ring-proof" ]
rfc-6979 = [ "hmac" ]
# Optimizations
parallel = [
"ark-ec/parallel",
"ark-ff/parallel",
"ark-std/parallel",
"ring-proof?/parallel",
"w3f-ring-proof?/parallel",
"rayon",
]
asm = [ "ark-ff/asm", "ring-proof?/asm" ]
asm = [ "ark-ff/asm", "w3f-ring-proof?/asm" ]
# Deterministic, no-zk, ring-proof (unsafe)
test-vectors = [ "ring-proof?/test-vectors" ]
test-vectors = [ "w3f-ring-proof?/test-vectors" ]

[package.metadata.docs.rs]
features = [ "full" ]
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@
//! - `default`: `std`
//! - `full`: Enables all features listed below except `secret-split`, `parallel`, `asm`, `rfc-6979`, `test-vectors`.
//! - `secret-split`: Point scalar multiplication with secret split. Secret scalar is split into the sum
//! of two scalars, which randomly mutate but retain the same sum. Incurs 2x penalty in some internal
//! sensible scalar multiplications, but provides side channel defenses.
//! of two scalars, which randomly mutate but retain the same sum. Incurs 2x penalty in some internal
//! sensible scalar multiplications, but provides side channel defenses.
//! - `ring`: Ring-VRF for the curves supporting it.
//! - `rfc-6979`: Support for nonce generation according to RFC-9381 section 5.4.2.1.
//! - `test-vectors`: Deterministic ring-vrf proof. Useful for reproducible test vectors generation.
Expand Down Expand Up @@ -425,7 +425,7 @@ macro_rules! suite_types {
mod tests {
use super::*;
use suites::testing::{Input, Secret};
use testing::{random_val, TEST_SEED};
use testing::{TEST_SEED, random_val};

#[test]
fn vrf_output_check() {
Expand Down
2 changes: 1 addition & 1 deletion src/pedersen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ impl<S: PedersenSuite> Verifier<S> for Public<S> {
#[cfg(test)]
pub(crate) mod testing {
use super::*;
use crate::testing::{self as common, random_val, CheckPoint, SuiteExt, TEST_SEED};
use crate::testing::{self as common, CheckPoint, SuiteExt, TEST_SEED, random_val};

pub fn prove_verify<S: PedersenSuite>() {
use pedersen::{Prover, Verifier};
Expand Down
1 change: 1 addition & 0 deletions src/ring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use ark_ec::{
use ark_std::ops::Range;
use pedersen::{PedersenSuite, Proof as PedersenProof};
use utils::te_sw_map::TEMapping;
use w3f_ring_proof as ring_proof;

/// Magic spell for [RingSuite::ACCUMULATOR_BASE] generation in built-in implementations.
///
Expand Down
8 changes: 5 additions & 3 deletions src/suites/bandersnatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,10 @@ pub(crate) mod tests {
fn elligator2_hash_to_curve() {
use crate::testing::CheckPoint;
let raw = crate::testing::random_vec(42, None);
assert!(ThisSuite::data_to_point(&raw)
.map(|p| p.check(true).ok())
.is_some());
assert!(
ThisSuite::data_to_point(&raw)
.map(|p| p.check(true).ok())
.is_some()
);
}
}
2 changes: 1 addition & 1 deletion src/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use ark_std::{vec, vec::Vec};

use crate::*;
use ark_std::{rand::RngCore, UniformRand};
use ark_std::{UniformRand, rand::RngCore};

pub const TEST_SEED: &[u8] = b"seed";

Expand Down
4 changes: 2 additions & 2 deletions src/utils/common.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::*;
use ark_ec::{
hashing::curve_maps::elligator2::{Elligator2Config, Elligator2Map},
AffineRepr,
hashing::curve_maps::elligator2::{Elligator2Config, Elligator2Map},
};
use ark_ff::PrimeField;
use digest::{Digest, FixedOutputReset};
Expand Down Expand Up @@ -80,7 +80,7 @@ where
Elligator2Map<CurveConfig<S>>:
ark_ec::hashing::map_to_curve_hasher::MapToCurve<<AffinePoint<S> as AffineRepr>::Group>,
{
use ark_ec::hashing::{map_to_curve_hasher::MapToCurveBasedHasher, HashToCurve};
use ark_ec::hashing::{HashToCurve, map_to_curve_hasher::MapToCurveBasedHasher};
use ark_ff::field_hashers::DefaultFieldHasher;

// Domain Separation Tag := "ECVRF_" || h2c_suite_ID_string || suite_string
Expand Down
2 changes: 1 addition & 1 deletion src/utils/te_sw_map.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use ark_ec::{
CurveConfig,
short_weierstrass::{Affine as SWAffine, SWCurveConfig},
twisted_edwards::{Affine as TEAffine, MontCurveConfig, TECurveConfig},
CurveConfig,
};
use ark_ff::{Field, One};
use ark_std::borrow::Cow;
Expand Down
Loading