Closed quanhanyu closed 8 years ago
Take a look at FHEPubKey::Encrypt
method in file FHE.h
. It allows to directly encrypt a polynomial. You can put your message in the zero-degree coefficient of a polynomial and encrypt it.
Actually, FHEPubKey::Encrypt
is the method used internally by EncryptedArray::encrypt
.
I can only find one method
long Encrypt(Ctxt &ciphertxt, const ZZX& plaintxt, long ptxtSpace=0, bool highNoise=false) const;
how can I encrypt one value?
Hi Jimmie, you can first encode one value into a ZZX, and then encrypt it using Encrypt( ). As ssmile said, you can put your message in the zero-degree coefficient of a ZZX polynomial.
Thank you very much and I've solved the problem.
By the way, are you a currently in Xidian University?
Yours
Jinwen Liang
2017-05-04 3:15 GMT+08:00 qhyhyl notifications@github.com:
Hi Jimmie, you can first encode one value into a ZZX, and then encrypt it using Encrypt( ). As ssmile said, you can put your message in the zero-degree coefficient of a ZZX polynomial.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/shaih/HElib/issues/88#issuecomment-299008119, or mute the thread https://github.com/notifications/unsubscribe-auth/AQbo2Jj6gAAW20UQNxYiJYoRmpdyXstnks5r2NJpgaJpZM4Iamob .
@JimmieLeung you are welcome. yes, i'm a student at xidian university.
I was wondering whether I can use helib without ciphertext packing techniques. For example, I want to encrypt two message m1 and m2, and compute Enc(m1+m2). According to Thomas's post, I wrote the following codes:
vector<long> v1; v1.push_back(m1); for(int i = 1 ; i < nslots; i++) { v1.push_back(0); } Ctxt ct1(publicKey); ea.encrypt(ct1, publicKey, v1);
vector<long> v2; v2.push_back(m2); for(int i = 1 ; i < nslots; i++) { v2.push_back(0); } Ctxt ct2(publicKey); ea.encrypt(ct2, publicKey, v2);
The codes above works but I was wonder whether I have another way to encrypt m1 and m2 without using packing?