cryprot_codes/
lib.rs

1//! Linear code implementations for Silent OT.
2//!
3//! This crate currently only implements the expand-convolute code of [[RRT23](https://eprint.iacr.org/2023/882)] in [`ex_conv`].
4use std::ops::{BitXor, BitXorAssign};
5
6use bytemuck::Pod;
7use cryprot_core::Block;
8
9pub mod ex_conv;
10
11pub use ex_conv::{ExConvCode, ExConvCodeConfig};
12
13/// Sealed trait implemented for [`Block`] and [`u8`].
14pub trait Coeff:
15    BitXor<Output = Self> + BitXorAssign + Copy + Clone + Pod + Sized + private::Sealed
16{
17    const ZERO: Self;
18}
19
20impl Coeff for Block {
21    const ZERO: Self = Block::ZERO;
22}
23
24impl Coeff for u8 {
25    const ZERO: Self = 0;
26}
27
28mod private {
29    pub trait Sealed {}
30
31    impl Sealed for super::Block {}
32    impl Sealed for u8 {}
33}