-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multi-proofs is supported on the crate? #38
Comments
Hi, type
|
@E-Mans-Application |
Hi! What do you mean exactly by "I don't want to send indexes"? In order to verify Merkle proof, you need to know indexes, otherwise you wouldn't know where the hashes you're trying to verify should fit into the proof |
@antouhou |
In the implementation above you still have to pass indexes, they're just in a form of bitflags. Converting indexes to bitflags and back is pretty staightforward, I just never needed this code for my usecase, so I never wrote the conversion. Here's a simple snippet on how to do that: fn indices_to_bitflags_vec(indices: &[usize], num_leaves: usize) -> Vec<u8> {
let num_bytes = (num_leaves + 7) / 8; // Calculate the number of bytes needed
let mut bitflags = vec![0u8; num_bytes];
for &index in indices {
if index < num_leaves {
let byte_index = index / 8;
let bit_index = index % 8;
bitflags[byte_index] |= 1 << bit_index;
}
}
bitflags
} Note, it should work, but I haven't really tested it |
rs-merkle/README.md
Lines 7 to 11 in ae7bc91
As per the readme description I am unable to find the interfaces for multiproof !
Is it already there? or there will be on new versions?
The text was updated successfully, but these errors were encountered: