Repository navigation
DamgardJurik Encryption Incorrect Results #71
Description
I wrote a short program to test DamgardJurik homomorphic encryption operations, but the results seem to be unstable. The code has been enclosed. I compiled the code and ran several times without any modification. The results are as follows, sometimes the result is correct, but sometimes it returns a big number or just corrupts with information "Sizes of ciphertexts do not match".
xxx@xxx-OptiPlex-7040:$ ./paillier.o
Original plaintext is: 123
Decrypted plaintext integer is: 123
Plaintext addition is: 246
Decrypted plaintext addition integer is: 246
Plaintext multiplication is: 12300
Decrypted plaintext multiplication integer is: 12300
xxx@xxx-OptiPlex-7040:$ ./paillier.o
Original plaintext is: 123
Decrypted plaintext integer is: 857489264902169263442986642532019006464198707881808385057494651564759059744
Plaintext addition is: 246
Decrypted plaintext addition integer is: 246
Plaintext multiplication is: 12300
Decrypted plaintext multiplication integer is: 12300
xxx@xxx-OptiPlex-7040:$ ./paillier.o
Original plaintext is: 123
Decrypted plaintext integer is: 123
Plaintext addition is: 246
Decrypted plaintext addition integer is: 246
Plaintext multiplication is: 12300
Decrypted plaintext multiplication integer is: 12300
xxx@xxx-OptiPlex-7040:$ ./paillier.o
Original plaintext is: 123
Decrypted plaintext integer is: 7613194334867773861088025509117736357398436373830484580326431442625258663984
terminate called after throwing an instance of 'std::invalid_argument'
what(): Sizes of ciphertexts do not match
Aborted (core dumped)
xxx@xxx-OptiPlex-7040:$ ./paillier.o
Original plaintext is: 123
Decrypted plaintext integer is: 123
Plaintext addition is: 246
Decrypted plaintext addition integer is: 1091673282608333264355044839660329762660415024419661640799801461129230991879
Plaintext multiplication is: 12300
Decrypted plaintext multiplication integer is: 12300
xxx@xxx-OptiPlex-7040:$ ./paillier.o
Original plaintext is: 123
Decrypted plaintext integer is: 123
Plaintext addition is: 246
Decrypted plaintext addition integer is: 246
Plaintext multiplication is: 12300
Decrypted plaintext multiplication integer is: 12300
xxx@xxx-OptiPlex-7040:$ ./paillier.o
Original plaintext is: 123
Decrypted plaintext integer is: 123
terminate called after throwing an instance of 'std::invalid_argument'
what(): Sizes of ciphertexts do not match
Aborted (core dumped)
I do not know what is the problem. Any help or advice would be appreciated. Thank you.
Test Code(1).pdf
Activity
[-]DamgardJurik Homomorphic computation error[/-][+]DamgardJurik Encryption Incorrect Results[/+]liorko87 commentedon Oct 22, 2019
At
void test_enc_and_dec()function this line is not complete at your PDF:biginteger r = getRandomInRange(0, dynamic_pointer_cast<DamgardJurikPuPlease complete it.
lemonviv commentedon Oct 23, 2019
`
#include <iostream>
#include <libscapi/include/mid_layer/DamgardJurikEnc.hpp>
void test_enc_and_dec() {
}
void test_add_and_mult() {
}
void test_fixed_precision_add_and_mult() {
}
int main(int argc, char* argv[]) {
test_enc_and_dec();
test_add_and_mult();
test_fixed_precision_add_and_mult();
}
`