|
@ -8,12 +8,13 @@ pub type Fr = poseidon_rs::Fr; // alias |
|
|
|
|
|
|
|
|
use arrayref::array_ref;
|
|
|
use arrayref::array_ref;
|
|
|
|
|
|
|
|
|
#[cfg(not(feature = "aarch64"))]
|
|
|
|
|
|
use blake_hash::Digest; // compatible version with Blake used at circomlib
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(feature = "aarch64")]
|
|
|
|
|
|
extern crate blake; // compatible version with Blake used at circomlib
|
|
|
|
|
|
|
|
|
// #[cfg(not(feature = "aarch64"))]
|
|
|
|
|
|
// use blake_hash::Digest; // compatible version with Blake used at circomlib
|
|
|
|
|
|
|
|
|
|
|
|
// #[cfg(feature = "aarch64")]
|
|
|
|
|
|
// extern crate blake; // compatible version with Blake used at circomlib
|
|
|
|
|
|
use blake2::{Blake2b512, Blake2s256, Digest};
|
|
|
|
|
|
// use hex_literal::hex;
|
|
|
use std::cmp::min;
|
|
|
use std::cmp::min;
|
|
|
|
|
|
|
|
|
use num_bigint::{BigInt, RandBigInt, Sign, ToBigInt};
|
|
|
use num_bigint::{BigInt, RandBigInt, Sign, ToBigInt};
|
|
@ -223,19 +224,29 @@ pub fn decompress_point(bb: [u8; 32]) -> Result { |
|
|
Ok(Point { x: x_fr, y: y_fr })
|
|
|
Ok(Point { x: x_fr, y: y_fr })
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
#[cfg(not(feature = "aarch64"))]
|
|
|
|
|
|
fn blh(b: &[u8]) -> Vec<u8> {
|
|
|
|
|
|
let hash = blake_hash::Blake512::digest(b);
|
|
|
|
|
|
hash.to_vec()
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
// #[cfg(not(feature = "aarch64"))]
|
|
|
|
|
|
// fn blh(b: &[u8]) -> Vec<u8> {
|
|
|
|
|
|
// println!("hashing {:?} {:?}", b.len(), b);
|
|
|
|
|
|
// let debugggggggggme = blake_hash::Blake512::digest(b);
|
|
|
|
|
|
// println!("debugging {:?}", debugggggggggme);
|
|
|
|
|
|
|
|
|
|
|
|
// let hash = blake_hash::Blake512::digest(b);
|
|
|
|
|
|
// hash.to_vec()
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// #[cfg(feature = "aarch64")]
|
|
|
|
|
|
// fn blh(b: &[u8]) -> Vec<u8> {
|
|
|
|
|
|
// let mut hash = [0; 64];
|
|
|
|
|
|
// blake::hash(512, b, &mut hash).unwrap();
|
|
|
|
|
|
// hash.to_vec()
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
#[cfg(feature = "aarch64")]
|
|
|
|
|
|
fn blh(b: &[u8]) -> Vec<u8> {
|
|
|
fn blh(b: &[u8]) -> Vec<u8> {
|
|
|
let mut hash = [0; 64];
|
|
|
|
|
|
blake::hash(512, b, &mut hash).unwrap();
|
|
|
|
|
|
hash.to_vec()
|
|
|
|
|
|
|
|
|
let mut h = Blake2b512::new();
|
|
|
|
|
|
h.update(b);
|
|
|
|
|
|
let digest = h.finalize();
|
|
|
|
|
|
return digest[..].to_vec();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
#[derive(Debug, Clone)]
|
|
|
#[derive(Debug, Clone)]
|
|
|
pub struct Signature {
|
|
|
pub struct Signature {
|
|
|
pub r_b8: Point,
|
|
|
pub r_b8: Point,
|
|
|