use super::*;
impl<N: Network> ToBits for Entry<N, Plaintext<N>> {
fn to_bits_le(&self) -> Vec<bool> {
let mut bits_le = match self {
Self::Constant(..) => vec![false, false],
Self::Public(..) => vec![false, true],
Self::Private(..) => vec![true, false],
};
match self {
Self::Constant(plaintext) => bits_le.extend(plaintext.to_bits_le()),
Self::Public(plaintext) => bits_le.extend(plaintext.to_bits_le()),
Self::Private(plaintext) => bits_le.extend(plaintext.to_bits_le()),
}
bits_le
}
fn to_bits_be(&self) -> Vec<bool> {
let mut bits_be = match self {
Self::Constant(..) => vec![false, false],
Self::Public(..) => vec![false, true],
Self::Private(..) => vec![true, false],
};
match self {
Self::Constant(plaintext) => bits_be.extend(plaintext.to_bits_be()),
Self::Public(plaintext) => bits_be.extend(plaintext.to_bits_be()),
Self::Private(plaintext) => bits_be.extend(plaintext.to_bits_be()),
}
bits_be
}
}
impl<N: Network> ToBits for Entry<N, Ciphertext<N>> {
fn to_bits_le(&self) -> Vec<bool> {
let mut bits_le = match self {
Self::Constant(..) => vec![false, false],
Self::Public(..) => vec![false, true],
Self::Private(..) => vec![true, false],
};
match self {
Self::Constant(plaintext) => bits_le.extend(plaintext.to_bits_le()),
Self::Public(plaintext) => bits_le.extend(plaintext.to_bits_le()),
Self::Private(plaintext) => bits_le.extend(plaintext.to_bits_le()),
}
bits_le
}
fn to_bits_be(&self) -> Vec<bool> {
let mut bits_be = match self {
Self::Constant(..) => vec![false, false],
Self::Public(..) => vec![false, true],
Self::Private(..) => vec![true, false],
};
match self {
Self::Constant(plaintext) => bits_be.extend(plaintext.to_bits_be()),
Self::Public(plaintext) => bits_be.extend(plaintext.to_bits_be()),
Self::Private(plaintext) => bits_be.extend(plaintext.to_bits_be()),
}
bits_be
}
}