Files
librustzcash/sapling-crypto/src/util.rs
Jack Grigg 051027cb6d Add 'sapling-crypto/' from commit '21084bde2019c04bd34208e63c3560fe2c02fb0e'
git-subtree-dir: sapling-crypto
git-subtree-mainline: 9f748554d0
git-subtree-split: 21084bde20
2018-08-28 23:04:13 +01:00

12 lines
342 B
Rust

use blake2_rfc::blake2b::Blake2b;
use jubjub::{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())
}