Skip to main content

PlaintextOps

Trait PlaintextOps 

Source
pub trait PlaintextOps<Plaintext = <Self as Reconstructible>::Value>: Reconstructible {
    // Required methods
    fn add_plaintext(self, ptx: &Plaintext, is_first_peer: bool) -> Self;
    fn sub_plaintext(self, ptx: &Plaintext, is_first_peer: bool) -> Self;
}
Expand description

Operates a secret share with a public plaintext (addition/subtraction). These are often asymmetric (e.g., only the first peer folds the constant into its share). Scaling a share by a public constant is expressed directly through Mul where needed, so it is not part of this trait.

Required Methods§

Source

fn add_plaintext(self, ptx: &Plaintext, is_first_peer: bool) -> Self

Add a plaintext to the share, consuming the share and returning a new one.

Source

fn sub_plaintext(self, ptx: &Plaintext, is_first_peer: bool) -> Self

Subtract a plaintext from the share, consuming the share and returning a new one.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<F: FieldExtension> PlaintextOps<SubfieldElement<F>> for SubfieldElement<F>

Adding a public constant to an unauthenticated additive share: only the first peer folds the constant into its share (x_0 ± c); every other peer’s share is unchanged, so the sum shifts by exactly c.

Source§

impl<V, A, B, M: Positive> PlaintextOps<V> for BatchedShare<V, A, B, M>
where BatchedShare<V, A, B, M>: Reconstructible<Value = HeapArray<V, M>> + Clone, for<'a> V: Copy + Mul<&'a A, Output = B>, HeapArray<V, M>: for<'a> AddAssign<&'a V> + for<'a> SubAssign<&'a V>, HeapArray<B, M>: for<'b> AddAssign<&'b B> + for<'b> SubAssign<&'b B>,

Broadcast a single (non-batched) plaintext to every column of a batched share.

This is the batched counterpart of the blanket PlaintextOps impl: where that one adds a full-width HeapArray<V, M> plaintext, this adds a single V to all M columns at once.

Source§

impl<V, A, B> PlaintextOps<V> for PairwiseAuthShare<V, A, B>
where PairwiseAuthShare<V, A, B>: Reconstructible<Value = V>, for<'a> V: Clone + for<'a> AddAssign<&'a V> + for<'a> SubAssign<&'a V> + Mul<&'a A, Output = B>, A: Clone, B: Clone + for<'b> AddAssign<&'b B> + for<'b> SubAssign<&'b B> + ConstantTimeEq,