Move redjubjub into zcash_primitives

This commit is contained in:
Jack Grigg
2019-05-04 17:47:18 +01:00
parent f931562431
commit 7ea6d10480
17 changed files with 36 additions and 31 deletions

View File

@@ -0,0 +1,10 @@
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())
}