-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathPlaintext.cpp
40 lines (31 loc) · 1.03 KB
/
Plaintext.cpp
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
#include "Plaintext.h"
#include "NumbTh.h"
#include <algorithm>
#include "assert.h"
void Plaintext::Init(const ZZ_pX &msg) {
message = msg;
}
void Plaintext::Init(const vector<ZZ_pX> &msgs) {
EmbedInSlots(msgs);
}
Plaintext &Plaintext::operator=(const Plaintext &other) {
assert(&context == &other.context);
message = other.message;
return *this;
}
bool Plaintext::operator==(const Plaintext &other) const {
return ((&context == &other.context) &&
(message == other.message));
}
void Plaintext::EmbedInSlots(const vector<ZZ_pX> &msgs, bool onlyUsable) {
context.GetPlaintextSpace().EmbedInSlots(message, msgs, onlyUsable);
}
void Plaintext::DecodeSlots(vector<ZZ_pX> &msgBatch, bool onlyUsable) {
context.GetPlaintextSpace().DecodeSlots(msgBatch, message, onlyUsable);
}
void Plaintext::DecodeSlot(ZZ_pX &val, unsigned slot) {
context.GetPlaintextSpace().DecodeSlot(val, message, slot);
}
ostream &operator<<(ostream &os, const Plaintext &ptxt) {
return (os << ptxt.message);
}