Switch to using the blake2-rfc crate instead.
This commit is contained in:
@@ -313,8 +313,7 @@ mod test {
|
||||
use ::circuit::test::TestConstraintSystem;
|
||||
use super::blake2s;
|
||||
use bellman::{ConstraintSystem};
|
||||
use blake2::{Blake2s};
|
||||
use digest::{FixedOutput, Input};
|
||||
use blake2_rfc::blake2s::Blake2s;
|
||||
|
||||
#[test]
|
||||
fn test_blake2s_constraints() {
|
||||
@@ -357,13 +356,13 @@ mod test {
|
||||
|
||||
for input_len in (0..32).chain((32..256).filter(|a| a % 8 == 0))
|
||||
{
|
||||
let mut h = Blake2s::new_keyed(&[], 32);
|
||||
let mut h = Blake2s::new(32);
|
||||
|
||||
let data: Vec<u8> = (0..input_len).map(|_| rng.gen()).collect();
|
||||
|
||||
h.process(&data);
|
||||
h.update(&data);
|
||||
|
||||
let hash_result = h.fixed_result();
|
||||
let hash_result = h.finalize();
|
||||
|
||||
let mut cs = TestConstraintSystem::<Bls12>::new();
|
||||
|
||||
|
||||
@@ -16,12 +16,12 @@ use bellman::{
|
||||
use std::collections::HashMap;
|
||||
use std::fmt::Write;
|
||||
|
||||
use blake2::{Blake2s};
|
||||
use digest::{FixedOutput, Input};
|
||||
use byteorder::{BigEndian, ByteOrder};
|
||||
use std::cmp::Ordering;
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use blake2_rfc::blake2s::Blake2s;
|
||||
|
||||
#[derive(Debug)]
|
||||
enum NamedObject {
|
||||
Constraint(usize),
|
||||
@@ -107,7 +107,7 @@ fn hash_lc<E: Engine>(
|
||||
|
||||
let mut buf = [0u8; 9 + 32];
|
||||
BigEndian::write_u64(&mut buf[0..8], map.len() as u64);
|
||||
h.process(&buf[0..8]);
|
||||
h.update(&buf[0..8]);
|
||||
|
||||
for (var, coeff) in map {
|
||||
match var.0.get_unchecked() {
|
||||
@@ -123,7 +123,7 @@ fn hash_lc<E: Engine>(
|
||||
|
||||
coeff.into_repr().write_be(&mut buf[9..]).unwrap();
|
||||
|
||||
h.process(&buf);
|
||||
h.update(&buf);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,14 +230,14 @@ impl<E: Engine> TestConstraintSystem<E> {
|
||||
}
|
||||
|
||||
pub fn hash(&self) -> String {
|
||||
let mut h = Blake2s::new_keyed(&[], 32);
|
||||
let mut h = Blake2s::new(32);
|
||||
{
|
||||
let mut buf = [0u8; 24];
|
||||
|
||||
BigEndian::write_u64(&mut buf[0..8], self.inputs.len() as u64);
|
||||
BigEndian::write_u64(&mut buf[8..16], self.aux.len() as u64);
|
||||
BigEndian::write_u64(&mut buf[16..24], self.constraints.len() as u64);
|
||||
h.process(&buf);
|
||||
h.update(&buf);
|
||||
}
|
||||
|
||||
for constraint in &self.constraints {
|
||||
@@ -247,7 +247,7 @@ impl<E: Engine> TestConstraintSystem<E> {
|
||||
}
|
||||
|
||||
let mut s = String::new();
|
||||
for b in h.fixed_result().as_ref() {
|
||||
for b in h.finalize().as_ref() {
|
||||
s += &format!("{:02x}", b);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user