arcium-core-utils 0.8.0

Arcium core utils
Documentation
use primitives::algebra::{
    elliptic_curve::{BaseFieldElement, Point, Scalar},
    field::{subfield_element::Mersenne107Element, Bit},
};
use serde::Deserialize;
#[cfg(test)]
use serde::Serialize;

use crate::circuit::old::legacy_codec::{legacy, LegacyBytes};

/// Enum representing a plaintext value. Can either be a fixed value provided with a circuit, or a
/// public input provided at runtime. The usize is the size of the batch.
///
/// `Fixed`'s payload keeps its pre-#748 `serde_bytes` encoding -- see [`LegacyBytes`].
#[derive(Deserialize)]
#[cfg_attr(test, derive(Serialize))]
#[repr(C)]
pub enum Plaintext<T: LegacyBytes> {
    Fixed(#[serde(with = "legacy")] T),
    Input(usize),
}

pub type ScalarPlaintext<C> = Plaintext<Scalar<C>>;
pub type BaseFieldPlaintext<C> = Plaintext<BaseFieldElement<C>>;
pub type Mersenne107Plaintext = Plaintext<Mersenne107Element>;
pub type PointPlaintext<C> = Plaintext<Point<C>>;
pub type BitPlaintext = Plaintext<Bit>;

pub type ScalarPlaintextBatch<C> = Plaintext<Vec<Scalar<C>>>;
pub type BaseFieldPlaintextBatch<C> = Plaintext<Vec<BaseFieldElement<C>>>;
pub type Mersenne107PlaintextBatch = Plaintext<Vec<Mersenne107Element>>;
pub type PointPlaintextBatch<C> = Plaintext<Vec<Point<C>>>;
pub type BitPlaintextBatch = Plaintext<Vec<Bit>>;