mirror of
https://github.com/Qortal/pirate-librustzcash.git
synced 2025-01-30 23:42:13 +00:00
051027cb6d
git-subtree-dir: sapling-crypto git-subtree-mainline:9f748554d0
git-subtree-split:21084bde20
24 lines
638 B
Rust
24 lines
638 B
Rust
#![feature(test)]
|
|
|
|
extern crate rand;
|
|
extern crate test;
|
|
extern crate pairing;
|
|
extern crate sapling_crypto;
|
|
|
|
use rand::{Rand, thread_rng};
|
|
use pairing::bls12_381::Bls12;
|
|
use sapling_crypto::jubjub::JubjubBls12;
|
|
use sapling_crypto::pedersen_hash::{pedersen_hash, Personalization};
|
|
|
|
#[bench]
|
|
fn bench_pedersen_hash(b: &mut test::Bencher) {
|
|
let params = JubjubBls12::new();
|
|
let rng = &mut thread_rng();
|
|
let bits = (0..510).map(|_| bool::rand(rng)).collect::<Vec<_>>();
|
|
let personalization = Personalization::MerkleTree(31);
|
|
|
|
b.iter(|| {
|
|
pedersen_hash::<Bls12, _>(personalization, bits.clone(), ¶ms)
|
|
});
|
|
}
|