Add 'sapling-crypto/' from commit '21084bde2019c04bd34208e63c3560fe2c02fb0e'
git-subtree-dir: sapling-crypto git-subtree-mainline:9f748554d0git-subtree-split:21084bde20
This commit is contained in:
11
sapling-crypto/src/util.rs
Normal file
11
sapling-crypto/src/util.rs
Normal file
@@ -0,0 +1,11 @@
|
||||
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())
|
||||
}
|
||||
Reference in New Issue
Block a user