Closed jeffneuen closed 4 years ago
No, not out of the box at least. All of the current code in frontend
is set up to do benchmarking...
It should be pretty easy to write an app that does this. First, parse your file and turn each element of your set into a block
. A block is just a 128 bit blob of memory. If your elements fit into 128 bits, then you can just memcpy
each element into a block. If the elements are greater than 128 bits, then you can hash your elements into 128 bits. e.g.
block hash(const std::string& yourElement) {
RandomOracle hasher(sizeof(block));
hasher.Update(yourElement.data(), yourElement.size());
block hashedElement;
hasher.Final(hashedElement);
return hashedElement;
}
You can then represent each set as a std::vector<block>
. You will pass this vector to the PSI implementation. For examples on how this works, see the unit test. But basically you'll have something like this (note, i have not compiled or tested this ;)
void sender(std::string filePath, u64 recvSetSize){
std::vector<block> sendSet = parse(filePath)
const u64 psiSecParam = 40;
IOService ios;
Endpoint ep0(ios, "localhost", 1212, EpMode::Client, name);
std::vector<Channel> sendChl{ep0.addChannel()};
OosNcoOtReceiver otRecv0;
OosNcoOtSender otSend0;
Rr17aMPsiSender send;
send.init(recvSetSize, psiSecParam, sendChl, otSend0, otRecv0, sysRandomSeed());
send.sendInput(sendSet, sendChl);
}
and
void receiver(std::string filePath, u64 senderSetSize) {
std::vector<block>recvSet = parse(filePath);
const u64 psiSecParam = 40;
IOService ios;
Endpoint ep1(ios, "localhost", 1212, EpMode::Server, name);
std::vector<Channel> recvChl{ep1.addChannel()};
OosNcoOtReceiver otRecv0, otRecv1;
OosNcoOtSender otSend0, otSend1;
Rr17aMPsiReceiver recv;
recv.init(senderSetSize, psiSecParam, recvChl, otRecv1, otSend1, sysRandomSeed());
recv.sendInput(recvSet, recvChl);
}
If you would like to write this code and do a pull request, that would be great!
Thank you for the detailed reply, Peter.
I am not much of a C coder, but I may take a stab at a PR, because libPSI seems to be the most complete and maintained PSI library available, and I'd like to use it!
This is now supported.
I have successfully compiled the library, I can run frontend.exe, and most unit tests pass. I am attempting to use either RR16, RR17, or DRRT18 to compare two .csv files comparing data.
Does this library support piping in a text file for use as data on the sender and receiver side, or is the data internally generated for testing purposes only.
I have checked out frontend.exe -u, but haven't been able to determine this yet. If this library does support this, would it be possible to provide a short example of what the required command line parameters would look like?