[−][src]Struct accumulator::Accumulator
A cryptographic accumulator. Wraps a single unknown-order group element and phantom data
representing the type T
being hashed-to-prime and accumulated.
Methods
impl<G: UnknownOrderGroup, T: Eq + Hash> Accumulator<G, T>
[src]
pub fn empty() -> Self
[src]
Returns a new, empty accumulator.
pub fn add(self, elems: &[T]) -> Self
[src]
Adds elems
to the accumulator. This cannot check whether the elements have already been
added, so is up to clients to ensure uniqueness.
Uses a move instead of a &self
reference to prevent accidental use of the old accumulator.
pub fn add_with_proof(self, elems: &[T]) -> (Self, MembershipProof<G, T>)
[src]
A specialized version of add
that also returns a batch membership proof for added elements.
pub fn delete(
self,
elem_witnesses: &[(T, Witness<G, T>)]
) -> Result<Self, AccError>
[src]
self,
elem_witnesses: &[(T, Witness<G, T>)]
) -> Result<Self, AccError>
Removes the elements in elem_witnesses
from the accumulator.
Arguments
elem_witnesses
- Tuples consisting of (element to delete, element's witness).
Uses a move instead of a &self
reference to prevent accidental use of the old accumulator.
pub fn delete_with_proof(
self,
elem_witnesses: &[(T, Witness<G, T>)]
) -> Result<(Self, MembershipProof<G, T>), AccError>
[src]
self,
elem_witnesses: &[(T, Witness<G, T>)]
) -> Result<(Self, MembershipProof<G, T>), AccError>
A specialized version of delete
that also returns a batch membership proof for deleted
elements.
pub fn prove_membership(
&self,
elem_witnesses: &[(T, Witness<G, T>)]
) -> Result<MembershipProof<G, T>, AccError>
[src]
&self,
elem_witnesses: &[(T, Witness<G, T>)]
) -> Result<MembershipProof<G, T>, AccError>
Computes the batch membership proof for the elements in elem_witnesses
w.r.t this
accumulator.
Arguments
elem_witnesses
- Tuples consisting of (element to prove, element's witness).
pub fn verify_membership(
&self,
t: &T,
MembershipProof { witness: witness, proof: proof }: &MembershipProof<G, T>
) -> bool
[src]
&self,
t: &T,
MembershipProof { witness: witness, proof: proof }: &MembershipProof<G, T>
) -> bool
Verifies a membership proof against the current accumulator and an element t
whose
inclusion is being proven.
pub fn verify_membership_batch(
&self,
elems: &[T],
MembershipProof { witness: witness, proof: proof }: &MembershipProof<G, T>
) -> bool
[src]
&self,
elems: &[T],
MembershipProof { witness: witness, proof: proof }: &MembershipProof<G, T>
) -> bool
Batch version of verify_membership
for multiple elems
.
pub fn update_membership_witness(
&self,
witness: Witness<G, T>,
tracked_elems: &[T],
untracked_additions: &[T],
untracked_deletions: &[T]
) -> Result<Witness<G, T>, AccError>
[src]
&self,
witness: Witness<G, T>,
tracked_elems: &[T],
untracked_additions: &[T],
untracked_deletions: &[T]
) -> Result<Witness<G, T>, AccError>
Updates a witness
for tracked_elems
w.r.t the current accumulator, adding the elements in
untracked_additions
to the tracked set and removing the elements in untracked_deletions
from the tracked set.
See Section 4.2 of LLX for implementation details.
pub fn prove_nonmembership(
&self,
acc_set: &[T],
elems: &[T]
) -> Result<NonmembershipProof<G, T>, AccError>
[src]
&self,
acc_set: &[T],
elems: &[T]
) -> Result<NonmembershipProof<G, T>, AccError>
Computes the batch non-membership proof for the elements in elems
w.r.t this accumulator
and its acc_set
.
Arguments
acc_set
- The set of elements committed to by this accumulator.elems
- The set of elements you want to prove are not inacc_set
.
pub fn verify_nonmembership(
&self,
elems: &[T],
NonmembershipProof { d: d, v: v, gv_inv: gv_inv, poke2_proof: poke2_proof, poe_proof: poe_proof, .. }: &NonmembershipProof<G, T>
) -> bool
[src]
&self,
elems: &[T],
NonmembershipProof { d: d, v: v, gv_inv: gv_inv, poke2_proof: poke2_proof, poe_proof: poe_proof, .. }: &NonmembershipProof<G, T>
) -> bool
Verifies a non-membership proof against the current accumulator and elements elems
whose
non-inclusion is being proven.
Trait Implementations
impl<G: Eq + UnknownOrderGroup, T: Eq> Eq for Accumulator<G, T> where
G::Elem: Eq,
[src]
G::Elem: Eq,
impl<G: PartialEq + UnknownOrderGroup, T: PartialEq> PartialEq<Accumulator<G, T>> for Accumulator<G, T> where
G::Elem: PartialEq,
[src]
G::Elem: PartialEq,
fn eq(&self, other: &Accumulator<G, T>) -> bool
[src]
fn ne(&self, other: &Accumulator<G, T>) -> bool
[src]
impl<G: UnknownOrderGroup, T: Eq + Hash, '_> From<&'_ [T]> for Accumulator<G, T>
[src]
impl<G: UnknownOrderGroup, T: Hash> Clone for Accumulator<G, T>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<G: Debug + UnknownOrderGroup, T: Debug> Debug for Accumulator<G, T> where
G::Elem: Debug,
[src]
G::Elem: Debug,
impl<G: Hash + UnknownOrderGroup, T: Hash> Hash for Accumulator<G, T> where
G::Elem: Hash,
[src]
G::Elem: Hash,
Auto Trait Implementations
impl<G, T> Send for Accumulator<G, T> where
T: Send,
<G as Group>::Elem: Send,
T: Send,
<G as Group>::Elem: Send,
impl<G, T> Sync for Accumulator<G, T> where
T: Sync,
<G as Group>::Elem: Sync,
T: Sync,
<G as Group>::Elem: Sync,
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Same for T
type Output = T
Should always be Self