tfhe/boolean/ciphertext/
mod.rsuse crate::core_crypto::entities::*;
use serde::{Deserialize, Serialize};
use tfhe_versionable::Versionize;
use super::backward_compatibility::ciphertext::{CiphertextVersions, CompressedCiphertextVersions};
#[derive(Clone, Debug, Serialize, Deserialize, Versionize)]
#[versionize(CiphertextVersions)]
pub enum Ciphertext {
Encrypted(LweCiphertextOwned<u32>),
Trivial(bool),
}
#[derive(Clone, Debug, Serialize, Deserialize, Versionize)]
#[versionize(CompressedCiphertextVersions)]
pub struct CompressedCiphertext {
pub(crate) ciphertext: SeededLweCiphertext<u32>,
}
impl CompressedCiphertext {
pub fn decompress(&self) -> Ciphertext {
Ciphertext::Encrypted(self.ciphertext.decompress_into_lwe_ciphertext())
}
pub fn into_raw_parts(self) -> SeededLweCiphertext<u32> {
self.ciphertext
}
pub fn from_raw_parts(ciphertext: SeededLweCiphertext<u32>) -> Self {
Self { ciphertext }
}
}