[−][src]Struct clacc::Update
A sum of updates to be applied to witnesses.
Implementations
impl<T: BigInt> Update<T>
[src]
pub fn new() -> Self
[src]
Create a new batched update.
pub fn add<Map: Mapper, N: ArrayLength<u8>>(&mut self, x: &[u8], w: &Witness<T>)
[src]
Absorb an element that must be added to a witness.
pub fn del<Map: Mapper, N: ArrayLength<u8>>(&mut self, x: &[u8], w: &Witness<T>)
[src]
Absorb an element that must be deleted from a witness.
pub fn undo_add<Map: Mapper, N: ArrayLength<u8>>(
&mut self,
x: &[u8],
w: &Witness<T>
)
[src]
&mut self,
x: &[u8],
w: &Witness<T>
)
Undo an absorbed element's addition into an update.
pub fn undo_del<Map: Mapper, N: ArrayLength<u8>>(
&mut self,
x: &[u8],
w: &Witness<T>
)
[src]
&mut self,
x: &[u8],
w: &Witness<T>
)
Undo an absorbed element's deletion from an update.
pub fn update_witness<Map: Mapper, N: ArrayLength<u8>>(
&self,
acc: &Accumulator<T>,
x: &[u8],
w: &Witness<T>
) -> Witness<T>
[src]
&self,
acc: &Accumulator<T>,
x: &[u8],
w: &Witness<T>
) -> Witness<T>
Update a witness. The update will include all additions and deletions previously absorbed into this update struct.
use clacc::Accumulator; use clacc::Update; use clacc::bigint::BigIntGmp; use clacc::mapper::MapBlake2b; use clacc::typenum::U16; // In this example, the update will include a deletion, so the // accumulator must be created with a private key. let p = vec![0x3d]; let q = vec![0x35]; let mut acc = Accumulator::<BigIntGmp>::with_private_key( p.as_slice().into(), q.as_slice().into() ); // Create the static element. let xs = b"abc"; // Create the deletion. let xd = b"def"; // Create the addition. let xa = b"ghi"; // Add the deletion element. acc.add::<MapBlake2b, U16>(xd); // Add the static element to the accumulator. let mut wxs = acc.add::<MapBlake2b, U16>(xs); // Delete the deletion element from the accumulator. let wxd = acc.prove::<MapBlake2b, U16>(xd).unwrap(); acc.del::<MapBlake2b, U16>(xd, &wxd).unwrap(); // Create an update object and absorb the addition and deletion. let mut u = Update::new(); u.del::<MapBlake2b, U16>(xd, &wxd); u.add::<MapBlake2b, U16>(xa, &acc.add::<MapBlake2b, U16>(xa)); // Update the static element's witness. wxs = u.update_witness::<MapBlake2b, U16>(&acc, xs, &wxs); assert!(acc.verify::<MapBlake2b, U16>(xs, &wxs).is_ok());
pub fn update_witnesses<Map: Mapper, N: ArrayLength<u8>>(
&self,
r: *mut Witness<T>,
ra: *mut Witness<T>,
acc: &Accumulator<T>,
x: *const Vec<u8>,
w: *const Witness<T>,
n: usize,
xa: *const Vec<u8>,
wa: *const Witness<T>,
na: usize,
thread_count: usize
) -> Result<(), &'static str>
[src]
&self,
r: *mut Witness<T>,
ra: *mut Witness<T>,
acc: &Accumulator<T>,
x: *const Vec<u8>,
w: *const Witness<T>,
n: usize,
xa: *const Vec<u8>,
wa: *const Witness<T>,
na: usize,
thread_count: usize
) -> Result<(), &'static str>
Multithreaded version of update_witness
that can update multiple
witnesses and automatically manage updates applied to newly added
elements.
It is assumed that the additional elements have been absorbed by the update and that their witnesses are the accumulator's value before any of the additions or deletions absorbed by this update were applied. Updating the witnesses for each of these additional elements is thus acheived by simply removing its respective element from the update and applying the result to its witness.
Arguments
r
- Receives updated witnesses for static elements.ra
- Receives update witnesse for added elements.acc
- The current accumulator.x
- Pointer to static elements.w
- Pointer to the witnesses of the static elements.n
- The number of static elements.xa
- Pointer to added elements.wa
- Pointer to the witnesses of the added elements.na
- The number of added elements.thread_count
- The number of threads to use. Returns an error if 0.
Trait Implementations
impl<T: Clone + BigInt> Clone for Update<T>
[src]
impl<T: Debug + BigInt> Debug for Update<T>
[src]
impl<T: BigInt> Display for Update<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Update<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Update<T>
impl<T> Sync for Update<T>
impl<T> Unpin for Update<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Update<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> 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, U> TryInto<U> 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<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,