Migrate to blake2b_simd and blake2s_simd crates

The primary reason for migrating is that these crates provide APIs for
setting the personalisation string. This enables us to depend solely on
published crates, and thus publish our own crates.

The SIMD implementations are ported from libsodium.

Closes #67.
This commit is contained in:
Jack Grigg
2019-06-04 13:15:12 +01:00
parent 91c6b0b3f0
commit 999dcbfcab
20 changed files with 172 additions and 129 deletions

View File

@@ -7,12 +7,9 @@ authors = [
[dependencies]
bellman = { path = "../bellman" }
blake2b_simd = "0.5"
byteorder = "1"
ff = { path = "../ff" }
pairing = { path = "../pairing" }
rand = "0.4"
sapling-crypto = { path = "../sapling-crypto" }
[dependencies.blake2-rfc]
git = "https://github.com/gtank/blake2-rfc"
rev = "7a5b5fc99ae483a0043db7547fb79a6fa44b88a9"

View File

@@ -1,10 +1,10 @@
use blake2_rfc::blake2b::Blake2b;
use blake2b_simd::State;
use std::io::{self, Read};
/// Abstraction over a reader which hashes the data being read.
pub struct HashReader<R: Read> {
reader: R,
hasher: Blake2b,
hasher: State,
}
impl<R: Read> HashReader<R> {
@@ -12,7 +12,7 @@ impl<R: Read> HashReader<R> {
pub fn new(reader: R) -> Self {
HashReader {
reader: reader,
hasher: Blake2b::new(64),
hasher: State::new(),
}
}

View File

@@ -1,5 +1,5 @@
extern crate bellman;
extern crate blake2_rfc;
extern crate blake2b_simd;
extern crate byteorder;
extern crate ff;
extern crate pairing;