|
@@ -162,14 +162,17 @@ void run_test_sender(uint32_t numots, uint32_t bitlength, snd_ot_flavor stype, r
|
|
|
X0.Reset();
|
|
|
X0.XOR(X[1]);
|
|
|
//Y[0]->Copy(X[1]);
|
|
|
- printf("X0:\n");
|
|
|
- //X[1]->PrintBinary(); // I added this line
|
|
|
- X0.PrintHex(); // I added this line
|
|
|
- printf("Y0:\n");
|
|
|
- Y[0]->PrintHex(); // I added this line
|
|
|
- printf("T0: \n");
|
|
|
- X[0]->PrintHex();
|
|
|
|
|
|
+ #ifdef VERBOSE
|
|
|
+ printf("X0:\n");
|
|
|
+ //X[1]->PrintBinary(); // I added this line
|
|
|
+ X0.PrintHex(); // I added this line
|
|
|
+ printf("Y0:\n");
|
|
|
+ Y[0]->PrintHex(); // I added this line
|
|
|
+ printf("T0: \n");
|
|
|
+ X[0]->PrintHex();
|
|
|
+ #endif
|
|
|
+
|
|
|
X[1]->XOR(X[0]);
|
|
|
|
|
|
//X[1] --> X0 \oplus T0
|
|
@@ -198,24 +201,25 @@ void run_test_sender(uint32_t numots, uint32_t bitlength, snd_ot_flavor stype, r
|
|
|
|
|
|
printf("\n\nLearnt Gamma0 = (X1 /cdot Y0) /oplus T------>>>>>> \n");
|
|
|
response.PrintHex();
|
|
|
- // std::ofstream gammafile0, X0file, Y0file;
|
|
|
- // gammafile0.open ("gamma0.txt", std::ios::out);
|
|
|
- // X0file.open("X0.txt", std::ios::out);
|
|
|
- // Y0file.open("Y0.txt", std::ios::out);
|
|
|
+
|
|
|
+ // std::ofstream gammafile0, X0file, Y0file;
|
|
|
+ // gammafile0.open ("gamma0.txt", std::ios::out);
|
|
|
+ // X0file.open("X0.txt", std::ios::out);
|
|
|
+ // Y0file.open("Y0.txt", std::ios::out);
|
|
|
|
|
|
int fd = open("./y0", O_WRONLY, O_CREAT);
|
|
|
ssize_t bytes = write(fd, Y[0]->GetArr(), Y[0]->GetSize());
|
|
|
- //std::cout << "bytes = " << bytes << std::endl;
|
|
|
+ std::cout << "bytes = " << bytes << std::endl;
|
|
|
close(fd);
|
|
|
|
|
|
int fd2 = open("./x0", O_WRONLY, O_CREAT);
|
|
|
ssize_t bytes2 = write(fd2, X0.GetArr(), X0.GetSize());
|
|
|
- //std::cout << "bytes = " << bytes2 << std::endl;
|
|
|
+ std::cout << "bytes = " << bytes2 << std::endl;
|
|
|
close(fd2);
|
|
|
|
|
|
- int fd3 = open("./gamma0", O_WRONLY, O_CREAT);
|
|
|
+ int fd3 = open("./gamma0", O_WRONLY, O_CREAT);
|
|
|
ssize_t bytes3 = write(fd3, response.GetArr(), response.GetSize());
|
|
|
- //std::cout << "bytes = " << bytes3 << std::endl;
|
|
|
+ std::cout << "bytes = " << bytes3 << std::endl;
|
|
|
close(fd3);
|
|
|
|
|
|
// for(size_t j = 0; j < numots; ++j)
|
|
@@ -267,14 +271,16 @@ void run_test_receiver(uint32_t numots, uint32_t bitlength, snd_ot_flavor stype,
|
|
|
X1.Create(numots, bitlength);
|
|
|
X1.Reset();
|
|
|
X1.XOR(X[1]);
|
|
|
- printf("X1:\n");
|
|
|
- //X[1]->PrintBinary(); // I added this line
|
|
|
- X1.PrintHex(); // I added this line
|
|
|
- printf("Y1:\n");
|
|
|
- Y[0]->PrintHex(); // I added this line
|
|
|
- printf("T1: \n");
|
|
|
- X[0]->PrintHex();
|
|
|
|
|
|
+ #ifdef VERBOSE
|
|
|
+ printf("X1:\n");
|
|
|
+ //X[1]->PrintBinary(); // I added this line
|
|
|
+ X1.PrintHex(); // I added this line
|
|
|
+ printf("Y1:\n");
|
|
|
+ Y[0]->PrintHex(); // I added this line
|
|
|
+ printf("T1: \n");
|
|
|
+ X[0]->PrintHex();
|
|
|
+ #endif
|
|
|
// X[1] -- > X1 \oplus T1
|
|
|
X[1]->XOR(X[0]);
|
|
|
|
|
@@ -305,42 +311,50 @@ void run_test_receiver(uint32_t numots, uint32_t bitlength, snd_ot_flavor stype,
|
|
|
|
|
|
// response.PrintBinary();
|
|
|
response.XOR(X[0]);
|
|
|
- printf("\n\nLearnt: Gamma1 = (X0 /cdot Y1) /oplus T------>>>>>> \n");
|
|
|
- response.PrintHex();
|
|
|
- std::ofstream gammafile1, X1file, Y1file;
|
|
|
+
|
|
|
+ #ifdef VERBOSE
|
|
|
+ printf("\n\nLearnt: Gamma1 = (X0 /cdot Y1) /oplus T------>>>>>> \n");
|
|
|
+ response.PrintHex();
|
|
|
+ #endif
|
|
|
+ //std::ofstream gammafile1, X1file, Y1file;
|
|
|
|
|
|
|
|
|
|
|
|
- int fd = open("./y1", O_WRONLY, O_CREAT);
|
|
|
- ssize_t bytes = write(fd, Y[0]->GetArr(), Y[0]->GetSize());
|
|
|
- std::cout << "bytes = " << bytes << std::endl;
|
|
|
- close(fd);
|
|
|
-
|
|
|
- int fd2 = open("./x1", O_WRONLY, O_CREAT);
|
|
|
- ssize_t bytes2 = write(fd2, X1.GetArr(), X1.GetSize());
|
|
|
- std::cout << "bytes = " << bytes2 << std::endl;
|
|
|
- close(fd2);
|
|
|
-
|
|
|
- int fd3 = open("./gamma1", O_WRONLY, O_CREAT);
|
|
|
- ssize_t bytes3 = write(fd3, response.GetArr(), response.GetSize());
|
|
|
- std::cout << "bytes = " << bytes3 << std::endl;
|
|
|
- close(fd3);
|
|
|
+ int fd = open("./y1", O_WRONLY, O_CREAT);
|
|
|
+ ssize_t bytes = write(fd, Y[0]->GetArr(), Y[0]->GetSize());
|
|
|
+
|
|
|
+ #ifdef VERBOSE
|
|
|
+ std::cout << "bytes = " << bytes << std::endl;
|
|
|
+ #endif
|
|
|
+
|
|
|
+ close(fd);
|
|
|
|
|
|
- std::cout << "X1: \n\n";
|
|
|
- X1.PrintHex();
|
|
|
+ int fd2 = open("./x1", O_WRONLY, O_CREAT);
|
|
|
+ ssize_t bytes2 = write(fd2, X1.GetArr(), X1.GetSize());
|
|
|
+
|
|
|
+ close(fd2);
|
|
|
|
|
|
- gammafile1.open ("gamma1.txt", std::ios::out);
|
|
|
- X1file.open("X1.txt", std::ios::out);
|
|
|
- Y1file.open("Y1.txt", std::ios::out);
|
|
|
- for(size_t j = 0; j < numots; ++j)
|
|
|
- {
|
|
|
- // std::cout << (int) response.GetBitNoMask(j);
|
|
|
- gammafile1 << (int) response.GetBitNoMask(j);
|
|
|
- X1file << (int) X1.GetBitNoMask(j);
|
|
|
- Y1file << (int) Y[0]->GetBitNoMask(j);
|
|
|
- }
|
|
|
+ int fd3 = open("./gamma1", O_WRONLY, O_CREAT);
|
|
|
+ ssize_t bytes3 = write(fd3, response.GetArr(), response.GetSize());
|
|
|
+
|
|
|
+ close(fd3);
|
|
|
+
|
|
|
+ #ifdef VERBOSE
|
|
|
+ std::cout << "X1: \n\n";
|
|
|
+ X1.PrintHex();
|
|
|
+ #endif
|
|
|
+ // gammafile1.open ("gamma1.txt", std::ios::out);
|
|
|
+ // X1file.open("X1.txt", std::ios::out);
|
|
|
+ // Y1file.open("Y1.txt", std::ios::out);
|
|
|
+ // for(size_t j = 0; j < numots; ++j)
|
|
|
+ // {
|
|
|
+ // // std::cout << (int) response.GetBitNoMask(j);
|
|
|
+ // gammafile1 << (int) response.GetBitNoMask(j);
|
|
|
+ // X1file << (int) X1.GetBitNoMask(j);
|
|
|
+ // Y1file << (int) Y[0]->GetBitNoMask(j);
|
|
|
+ // }
|
|
|
|
|
|
- gammafile1.close();
|
|
|
+ //gammafile1.close();
|
|
|
delete m_fMaskFct;
|
|
|
// choices.delCBitVector();
|
|
|
response.delCBitVector();
|