Skip to content

Commit

Permalink
Revert to Blake2
Browse files Browse the repository at this point in the history
  • Loading branch information
autquis committed Oct 25, 2024
1 parent 0858433 commit c2ba181
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
1 change: 0 additions & 1 deletion poly-commit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ ark-crypto-primitives = {version = "^0.4.0", default-features = false, features
ark-std = { version = "^0.4.0", default-features = false }

blake2 = { version = "0.10", default-features = false }
blake3 = { version = "1.5.4", default-features = false }
derivative = { version = "2", features = [ "use_core" ] }
digest = "0.10"

Expand Down
5 changes: 4 additions & 1 deletion poly-commit/src/constraints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,10 @@ pub struct LabeledPointVar<TargetField: PrimeField, BaseField: PrimeField> {
/// An allocated version of `QuerySet`.
#[derive(Clone)]
pub struct QuerySetVar<TargetField: PrimeField, BaseField: PrimeField>(
pub HashSet<(String, LabeledPointVar<TargetField, BaseField>), DefaultHasher>,
pub HashSet<
(String, LabeledPointVar<TargetField, BaseField>),
BuildHasherDefault<DefaultHasher>,
>,
);

/// An allocated version of `Evaluations`.
Expand Down
12 changes: 8 additions & 4 deletions poly-commit/src/hyrax/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ use ark_poly::MultilinearExtension;
use ark_serialize::serialize_to_vec;
use ark_std::{marker::PhantomData, rand::RngCore, string::ToString, vec::Vec, UniformRand};

use blake2::Blake2s256;
use digest::Digest;

#[cfg(feature = "parallel")]
use rayon::prelude::*;

Expand Down Expand Up @@ -144,15 +147,16 @@ where
// generators, since the point at infinity should theoretically occur)
let points: Vec<_> = ark_std::cfg_into_iter!(0u64..dim + 1)
.map(|i| {
let hash = blake3::hash([PROTOCOL_NAME, &i.to_le_bytes()].concat().as_slice());
let mut p = G::from_random_bytes(hash.as_bytes());
let hash =
Blake2s256::digest([PROTOCOL_NAME, &i.to_le_bytes()].concat().as_slice());
let mut p = G::from_random_bytes(&hash);
let mut j = 0u64;
while p.is_none() {
let mut bytes = PROTOCOL_NAME.to_vec();
bytes.extend(i.to_le_bytes());
bytes.extend(j.to_le_bytes());
let hash = blake3::hash(bytes.as_slice());
p = G::from_random_bytes(hash.as_bytes());
let hash = Blake2s256::digest(bytes.as_slice());
p = G::from_random_bytes(&hash);
j += 1;
}
let point = p.unwrap();
Expand Down

0 comments on commit c2ba181

Please sign in to comment.