1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
use crate::commons::crypto::glwe::GlweCiphertext as ImplGlweCiphertext;
use crate::prelude::{GlweDimension, PolynomialSize};
use crate::specification::entities::markers::GlweCiphertextKind;
use crate::specification::entities::{AbstractEntity, GlweCiphertextEntity};
#[cfg(feature = "backend_default_serialization")]
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct GlweCiphertext32(pub(crate) ImplGlweCiphertext<Vec<u32>>);
impl AbstractEntity for GlweCiphertext32 {
type Kind = GlweCiphertextKind;
}
impl GlweCiphertextEntity for GlweCiphertext32 {
fn glwe_dimension(&self) -> GlweDimension {
self.0.size().to_glwe_dimension()
}
fn polynomial_size(&self) -> PolynomialSize {
self.0.polynomial_size()
}
}
#[cfg(feature = "backend_default_serialization")]
#[derive(Serialize, Deserialize)]
pub(crate) enum GlweCiphertext32Version {
V0,
#[serde(other)]
Unsupported,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct GlweCiphertext64(pub(crate) ImplGlweCiphertext<Vec<u64>>);
impl AbstractEntity for GlweCiphertext64 {
type Kind = GlweCiphertextKind;
}
impl GlweCiphertextEntity for GlweCiphertext64 {
fn glwe_dimension(&self) -> GlweDimension {
self.0.size().to_glwe_dimension()
}
fn polynomial_size(&self) -> PolynomialSize {
self.0.polynomial_size()
}
}
#[cfg(feature = "backend_default_serialization")]
#[derive(Serialize, Deserialize)]
pub(crate) enum GlweCiphertext64Version {
V0,
#[serde(other)]
Unsupported,
}
#[derive(Debug, PartialEq, Eq)]
pub struct GlweCiphertextView32<'a>(pub(crate) ImplGlweCiphertext<&'a [u32]>);
impl AbstractEntity for GlweCiphertextView32<'_> {
type Kind = GlweCiphertextKind;
}
impl GlweCiphertextEntity for GlweCiphertextView32<'_> {
fn glwe_dimension(&self) -> GlweDimension {
self.0.size().to_glwe_dimension()
}
fn polynomial_size(&self) -> PolynomialSize {
self.0.polynomial_size()
}
}
#[derive(Debug, PartialEq, Eq)]
pub struct GlweCiphertextMutView32<'a>(pub(crate) ImplGlweCiphertext<&'a mut [u32]>);
impl AbstractEntity for GlweCiphertextMutView32<'_> {
type Kind = GlweCiphertextKind;
}
impl GlweCiphertextEntity for GlweCiphertextMutView32<'_> {
fn glwe_dimension(&self) -> GlweDimension {
self.0.size().to_glwe_dimension()
}
fn polynomial_size(&self) -> PolynomialSize {
self.0.polynomial_size()
}
}
#[derive(Debug, PartialEq, Eq)]
pub struct GlweCiphertextView64<'a>(pub(crate) ImplGlweCiphertext<&'a [u64]>);
impl AbstractEntity for GlweCiphertextView64<'_> {
type Kind = GlweCiphertextKind;
}
impl GlweCiphertextEntity for GlweCiphertextView64<'_> {
fn glwe_dimension(&self) -> GlweDimension {
self.0.size().to_glwe_dimension()
}
fn polynomial_size(&self) -> PolynomialSize {
self.0.polynomial_size()
}
}
#[derive(Debug, PartialEq, Eq)]
pub struct GlweCiphertextMutView64<'a>(pub(crate) ImplGlweCiphertext<&'a mut [u64]>);
impl AbstractEntity for GlweCiphertextMutView64<'_> {
type Kind = GlweCiphertextKind;
}
impl GlweCiphertextEntity for GlweCiphertextMutView64<'_> {
fn glwe_dimension(&self) -> GlweDimension {
self.0.size().to_glwe_dimension()
}
fn polynomial_size(&self) -> PolynomialSize {
self.0.polynomial_size()
}
}