[][src]Struct accumulator::Accumulator

pub struct Accumulator<G: UnknownOrderGroup, T> { /* fields omitted */ }

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]

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]

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]

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]

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]

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]

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]

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 in acc_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]

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]

impl<G: PartialEq + UnknownOrderGroup, T: PartialEq> PartialEq<Accumulator<G, T>> for Accumulator<G, T> where
    G::Elem: PartialEq
[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_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]

impl<G: Hash + UnknownOrderGroup, T: Hash> Hash for Accumulator<G, T> where
    G::Elem: Hash
[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

Auto Trait Implementations

impl<G, T> Send for Accumulator<G, T> where
    T: Send,
    <G as Group>::Elem: Send

impl<G, T> Sync for Accumulator<G, T> where
    T: Sync,
    <G as Group>::Elem: Sync

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Same for T

type Output = T

Should always be Self