mirror of
https://github.com/Qortal/pirate-librustzcash.git
synced 2025-07-31 04:21:23 +00:00
11 lines
364 B
Rust
11 lines
364 B
Rust
use blake2b_simd::Params;
|
|
use sapling_crypto::jubjub::{JubjubEngine, ToUniform};
|
|
|
|
pub fn hash_to_scalar<E: JubjubEngine>(persona: &[u8], a: &[u8], b: &[u8]) -> E::Fs {
|
|
let mut hasher = Params::new().hash_length(64).personal(persona).to_state();
|
|
hasher.update(a);
|
|
hasher.update(b);
|
|
let ret = hasher.finalize();
|
|
E::Fs::to_uniform(ret.as_ref())
|
|
}
|