Created
June 13, 2018 14:19
-
-
Save sgkim126/66a077b914263768d479c842bae7e30b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn skewed_merkle_root<Iter, In, Out, Xor>(base: Out, inputs: Iter) -> Out | |
where | |
Iter: IntoIterator<Item = In>, | |
In: AsRef<[u8]>, | |
Xor: AsRef<[u8]>, | |
Out: BitXor<Output = Xor> + Blake, { | |
inputs.into_iter().fold(base, |acc, input| { | |
let xor = acc ^ Blake::blake(input); | |
Blake::blake(&xor) | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment