arcis-compiler 0.10.3

A framework for writing secure multi-party computation (MPC) circuits to be executed on the Arcium network.
Documentation
use crate::core::expressions::field_expr::PlayerId;
use serde::{Deserialize, Serialize};

pub mod bit_expr;
pub mod circuit;
pub mod conversion_expr;
pub mod curve_expr;
pub mod domain;
pub mod expr;
pub mod expr_macros;
pub mod field_expr;
pub mod macro_uses;
pub mod other_expr;
#[cfg(test)]
pub mod random_expr;

/// The kind of input.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum InputKind {
    Secret,
    SecretFromPlayer(PlayerId),
    Plaintext,
}
impl InputKind {
    pub fn is_plaintext(&self) -> bool {
        match self {
            InputKind::Secret => false,
            InputKind::SecretFromPlayer(_) => false,
            InputKind::Plaintext => true,
        }
    }
    pub fn to_input(
        self,
        algebraic_type: core_utils::circuit::AlgebraicType,
    ) -> core_utils::circuit::Input {
        match self {
            InputKind::Secret => core_utils::circuit::Input::Share {
                algebraic_type,
                batch_size: 1,
            },
            InputKind::SecretFromPlayer(i) => core_utils::circuit::Input::SecretPlaintext {
                inputer: i,
                algebraic_type,
                batch_size: 1,
            },
            InputKind::Plaintext => core_utils::circuit::Input::Plaintext {
                algebraic_type,
                batch_size: 1,
            },
        }
    }
}