sapling-crypto_ce 0.1.3

Cryptographic library for Zcash Sapling with more content
Documentation
1
2
3
4
5
6
7
8
9
10
11
use blake2_rfc::blake2b::Blake2b;

use babyjubjub::{JubjubEngine, ToUniform};

pub fn hash_to_scalar<E: JubjubEngine>(persona: &[u8], a: &[u8], b: &[u8]) -> E::Fs {
    let mut hasher = Blake2b::with_params(64, &[], &[], persona);
    hasher.update(a);
    hasher.update(b);
    let ret = hasher.finalize();
    E::Fs::to_uniform(ret.as_ref())
}