### Configuring Dependency Paths with Build Script Source: https://github.com/ladnir/volepsi/blob/main/README.md Shows how to specify custom installation paths for dependencies when running the VolePSI build script. ```bash python3 build.py -D CMAKE_PREFIX_PATH=install/prefix/path ``` -------------------------------- ### Install Vole-PSI Library Source: https://github.com/ladnir/volepsi/blob/main/README.md Commands to install the compiled Vole-PSI library and its dependencies to the system or a specified prefix path. ```bash python3 build.py --install # Or with a custom prefix python3 build.py --install=install/prefix/path ``` -------------------------------- ### CMake Integration Source: https://context7.com/ladnir/volepsi/llms.txt This CMakeLists.txt example shows how to integrate the Vole-PSI library into a CMake project. It uses `find_package` to locate the installed library and `target_link_libraries` to link it against your executable. ```APIDOC ## CMake Integration ### Description This section provides instructions on how to integrate the Vole-PSI library into your CMake build system. It covers the necessary commands to find the package and link against the library. ### Method N/A (This is a CMake configuration example) ### Endpoint N/A ### Parameters N/A ### Request Example ```cmake cmake_minimum_required(VERSION 3.15) project(MyPsiProject) # Find volePSI package find_package(volepsi REQUIRED) # Create executable add_executable(my_psi_app main.cpp) # Link volePSI library target_link_libraries(my_psi_app PRIVATE visa::volepsi) # If volePSI is in a custom location, specify the path: # find_package(volepsi HINTS /path/to/volepsi/install) ``` ### Response N/A (This is a CMake configuration example) #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Secure Two-Party Circuit Evaluation with GMW Protocol (C++) Source: https://context7.com/ladnir/volepsi/llms.txt Implements the GMW protocol for secure two-party circuit evaluation. This example demonstrates setting up a simple AND circuit, defining inputs for two parties, executing the protocol, and retrieving the securely computed output. It requires the cryptoTools and volePSI libraries. ```C++ #include "volePSI/GMW/Gmw.h" #include "cryptoTools/Circuit/BetaCircuit.h" void secureCircuitEvaluation() { // Define a simple circuit (e.g., AND of two inputs) oc::BetaCircuit circuit; oc::BetaBundle inputA(64); // 64-bit input from party 0 oc::BetaBundle inputB(64); // 64-bit input from party 1 oc::BetaBundle output(64); // 64-bit output circuit.addInputBundle(inputA); circuit.addInputBundle(inputB); circuit.addOutputBundle(output); // Add AND gates between corresponding bits for (u64 i = 0; i < 64; ++i) { circuit.addGate(inputA[i], inputB[i], oc::GateType::And, output[i]); } auto sockets = coproto::LocalAsyncSocket::makePair(); oc::PRNG prng(oc::sysRandomSeed()); // Party 0 setup volePSI::Gmw gmw0; gmw0.init(1, circuit, 1, 0, prng.get()); // pIdx = 0 // Party 1 setup volePSI::Gmw gmw1; gmw1.init(1, circuit, 1, 1, prng.get()); // pIdx = 1 // Set inputs (each party provides their input) u64 partyAInput = 0xDEADBEEF; u64 partyBInput = 0xCAFEBABE; oc::Matrix inputMatrixA(1, 1); oc::Matrix inputMatrixB(1, 1); inputMatrixA(0, 0) = partyAInput; inputMatrixB(0, 0) = partyBInput; gmw0.setInput(0, inputMatrixA); gmw1.setInput(1, inputMatrixB); // Generate multiplication triples and run protocol auto proto0 = gmw0.run(sockets[0]); auto proto1 = gmw1.run(sockets[1]); // Execute protocols macoro::sync_wait(proto0); macoro::sync_wait(proto1); // Get output shares oc::Matrix output0(1, 1), output1(1, 1); gmw0.getOutput(0, output0); gmw1.getOutput(0, output1); // Combine shares to get result u64 result = output0(0, 0) ^ output1(0, 0); std::cout << "Secure AND result: 0x" << std::hex << result << std::endl; std::cout << "Expected: 0x" << (partyAInput & partyBInput) << std::endl; } ``` -------------------------------- ### CMake Integration for Vole-PSI Source: https://context7.com/ladnir/volepsi/llms.txt Demonstrates how to integrate the Vole-PSI library into a CMake project. It shows the necessary commands to find the installed package and link the library to an executable target. ```cmake cmake_minimum_required(VERSION 3.15) project(MyPsiProject) # Find volePSI package find_package(volepsi REQUIRED) # Create executable add_executable(my_psi_app main.cpp) # Link volePSI library target_link_libraries(my_psi_app PRIVATE visa::volepsi) # If volePSI is in a custom location, specify the path: # find_package(volepsi HINTS /path/to/volepsi/install) ``` -------------------------------- ### Manual Message Passing with BufferingSocket (C++) Source: https://context7.com/ladnir/volepsi/llms.txt Demonstrates how to perform Private Set Intersection (PSI) using the VolePSI library with manual message passing. It utilizes BufferingSocket to integrate with custom transport layers, allowing for environments without direct socket communication. The example initializes sender and receiver protocols and manually exchanges messages until completion. ```cpp #include "volePSI/RsPsi.h" #include "coproto/Socket/BufferingSocket.h" void manualMessagePassing() { u64 senderSetSize = 100; u64 receiverSetSize = 100; u64 ssp = 40; bool malicious = false; // Create buffering sockets for both parties coproto::BufferingSocket senderSocket, receiverSocket; // Initialize sets std::vector senderSet(senderSetSize), receiverSet(receiverSetSize); oc::PRNG prng(oc::sysRandomSeed()); for (u64 i = 0; i < senderSetSize; ++i) senderSet[i] = oc::block(0, i); for (u64 i = 0; i < receiverSetSize; ++i) receiverSet[i] = oc::block(0, i); // Initialize protocols volePSI::RsPsiSender sender; volePSI::RsPsiReceiver receiver; sender.init(senderSetSize, receiverSetSize, ssp, prng.get(), malicious, 1); receiver.init(senderSetSize, receiverSetSize, ssp, prng.get(), malicious, 1); // Start protocols eagerly auto senderProto = sender.run(senderSet, senderSocket) | macoro::make_eager(); auto receiverProto = receiver.run(receiverSet, receiverSocket) | macoro::make_eager(); // Manual message exchange loop while (!senderProto.is_ready() || !receiverProto.is_ready()) { // Get outbound message from sender auto senderMsg = senderSocket.getOutbound(); if (senderMsg && senderMsg->size() > 0) { // Transport this message to receiver (via any custom channel) receiverSocket.processInbound(*senderMsg); } // Get outbound message from receiver auto receiverMsg = receiverSocket.getOutbound(); if (receiverMsg && receiverMsg->size() > 0) { // Transport this message to sender senderSocket.processInbound(*receiverMsg); } } // Get results coproto::sync_wait(senderProto); coproto::sync_wait(receiverProto); std::cout << "Intersection size: " << receiver.mIntersection.size() << std::endl; } ``` -------------------------------- ### Build Vole-PSI with Networking Support Source: https://github.com/ladnir/volepsi/blob/main/README.md Commands to clone the repository and build the library with networking support enabled using the provided Python build script. ```bash git clone https://github.com/Visa-Research/volepsi.git cd volepsi python3 build.py -DVOLE_PSI_ENABLE_BOOST=ON ``` -------------------------------- ### Run VolePSI Sender (Party 0) Source: https://context7.com/ladnir/volepsi/llms.txt Executes the VolePSI sender using the frontend executable. It takes the input CSV file, specifies the role as sender (0), and sets the IP address and port for communication. It also includes an option for secure set processing (ssp). ```bash ./out/build/linux/frontend/frontend \ -in sender_set.csv \ -r 0 \ -ip localhost:1212 \ -ssp 40 ``` -------------------------------- ### Use Binary File Format Source: https://context7.com/ladnir/volepsi/llms.txt Enables the use of a binary file format for input data instead of CSV. This can be more efficient for large datasets. Requires the input data file, the binary flag, and the sender role (0). ```bash ./out/build/linux/frontend/frontend \ -in data.bin \ -bin \ -r 0 ``` -------------------------------- ### Run VolePSI Receiver (Party 1) Source: https://context7.com/ladnir/volepsi/llms.txt Executes the VolePSI receiver using the frontend executable. It takes the input CSV file, specifies the role as receiver (1), defines the output file for the intersection, and sets the IP address and port for communication. It also includes an option for secure set processing (ssp). ```bash ./out/build/linux/frontend/frontend \ -in receiver_set.csv \ -r 1 \ -out intersection.csv \ -ip localhost:1212 \ -ssp 40 ``` -------------------------------- ### Linking VolePSI with CMake Source: https://github.com/ladnir/volepsi/blob/main/README.md Demonstrates how to locate and link the VolePSI library into a CMake-based project using find_package and target_link_libraries. ```cmake find_package(volepsi REQUIRED) target_link_libraries(myProject visa::volepsi) ``` -------------------------------- ### Run Standard PSI Sender Protocol (C++) Source: https://context7.com/ladnir/volepsi/llms.txt Implements the sender side of the standard Private Set Intersection protocol. The sender provides a set of elements, and the receiver learns the intersection. Requires initialization with set sizes, security parameters, and then runs the protocol via a Coproto socket connection. Dependencies include volePSI, coproto, and oc::block. ```cpp #include "volePSI/RsPsi.h" #include "coproto/Socket/AsioSocket.h" void runPsiSender() { // Configuration u64 senderSetSize = 10000; u64 receiverSetSize = 10000; u64 statisticalSecurityParam = 40; bool maliciousSecurity = false; u64 numThreads = 1; bool useReducedRounds = false; // Generate sender's set (16-byte blocks) std::vector senderSet(senderSetSize); oc::PRNG prng(oc::sysRandomSeed()); for (u64 i = 0; i < senderSetSize; ++i) { senderSet[i] = oc::block(0, i); // Example: sequential elements } // Connect to receiver coproto::Socket socket = coproto::asioConnect("localhost:1212", false); // Initialize and run sender protocol volePSI::RsPsiSender sender; sender.setMultType(oc::DefaultMultType); // VOLE multiplication type sender.init(senderSetSize, receiverSetSize, statisticalSecurityParam, prng.get(), maliciousSecurity, numThreads, useReducedRounds); // Execute protocol (blocks until complete) macoro::sync_wait(sender.run(senderSet, socket)); std::cout << "PSI sender completed successfully" << std::endl; } ``` -------------------------------- ### GMW Protocol - Secure Circuit Evaluation Source: https://context7.com/ladnir/volepsi/llms.txt This C++ code demonstrates how to use the GMW class for secure two-party circuit evaluation. It sets up a simple circuit (AND of two 64-bit inputs), initializes two GMW instances for each party, sets their respective inputs, and executes the protocol to securely compute the output. ```APIDOC ## GMW Protocol - Secure Circuit Evaluation ### Description This section details the implementation of the Goldreich-Micali-Wigderson (GMW) protocol for secure two-party circuit evaluation using the `volePSI::Gmw` class. It is designed for scenarios requiring secure computation on private inputs. ### Method N/A (This is a code example, not an API endpoint) ### Endpoint N/A ### Parameters N/A ### Request Example ```cpp #include "volePSI/GMW/Gmw.h" #include "cryptoTools/Circuit/BetaCircuit.h" #include "coproto/Socket.h" #include "cryptoTools/Crypto/PRNG.h" #include "macoro/sync.h" #include void secureCircuitEvaluation() { // Define a simple circuit (e.g., AND of two inputs) oc::BetaCircuit circuit; oc::BetaBundle inputA(64); // 64-bit input from party 0 oc::BetaBundle inputB(64); // 64-bit input from party 1 oc::BetaBundle output(64); // 64-bit output circuit.addInputBundle(inputA); circuit.addInputBundle(inputB); circuit.addOutputBundle(output); // Add AND gates between corresponding bits for (u64 i = 0; i < 64; ++i) { circuit.addGate(inputA[i], inputB[i], oc::GateType::And, output[i]); } auto sockets = coproto::LocalAsyncSocket::makePair(); oc::PRNG prng(oc::sysRandomSeed()); // Party 0 setup volePSI::Gmw gmw0; gmw0.init(1, circuit, 1, 0, prng.get()); // pIdx = 0 // Party 1 setup volePSI::Gmw gmw1; gmw1.init(1, circuit, 1, 1, prng.get()); // pIdx = 1 // Set inputs (each party provides their input) u64 partyAInput = 0xDEADBEEF; u64 partyBInput = 0xCAFEBABE; oc::Matrix inputMatrixA(1, 1); oc::Matrix inputMatrixB(1, 1); inputMatrixA(0, 0) = partyAInput; inputMatrixB(0, 0) = partyBInput; gmw0.setInput(0, inputMatrixA); gmw1.setInput(1, inputMatrixB); // Generate multiplication triples and run protocol auto proto0 = gmw0.run(sockets[0]); auto proto1 = gmw1.run(sockets[1]); // Execute protocols macoro::sync_wait(proto0); macoro::sync_wait(proto1); // Get output shares oc::Matrix output0(1, 1), output1(1, 1); gmw0.getOutput(0, output0); gmw1.getOutput(0, output1); // Combine shares to get result u64 result = output0(0, 0) ^ output1(0, 0); std::cout << "Secure AND result: 0x" << std::hex << result << std::endl; std::cout << "Expected: 0x" << (partyAInput & partyBInput) << std::endl; } ``` ### Response N/A (This is a code example, not an API endpoint) #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Configure VolePSI Frontend Executable Source: https://github.com/ladnir/volepsi/blob/main/frontend/CMakeLists.txt This CMake snippet collects all C++ source files recursively, defines the frontend executable, and links the necessary test libraries. It also includes conditional logic to handle compiler-specific flags for LTO and C++ standard versions. ```cmake file(GLOB_RECURSE SRCS *.cpp) add_executable(frontend ${SRCS}) target_link_libraries(frontend volePSI_Tests) if(VOLE_PSI_NO_LTO) target_link_options(frontend PUBLIC "-fno-lto") endif() if(MSVC) target_compile_options(frontend PRIVATE $<$:/std:c++${VOLE_PSI_STD_VER}>) else() target_compile_options(frontend PRIVATE $<$:-std=c++${VOLE_PSI_STD_VER}>) endif() ``` -------------------------------- ### Baxos: Binned OKVS Data Structure Source: https://context7.com/ladnir/volepsi/llms.txt Implements a binned Oblivious Key-Value Store (OKVS) using the Paxos algorithm. It efficiently encodes key-value pairs into a compressed structure that can be decoded to retrieve values for known keys. Supports initialization, encoding (solve), and decoding of key-value pairs. ```cpp #include "volePSI/Paxos.h" void demonstrateBaxos() { u64 numItems = 10000; u64 binSize = 1 << 14; // Items per bin u64 weight = 3; // Sparse weight parameter u64 statisticalSecurityParam = 40; oc::PRNG prng(oc::sysRandomSeed()); oc::block seed = prng.get(); // Initialize Baxos volePSI::Baxos baxos; baxos.init(numItems, binSize, weight, statisticalSecurityParam, volePSI::PaxosParam::DenseType::GF128, seed); // Generate keys and values std::vector keys(numItems); std::vector values(numItems); for (u64 i = 0; i < numItems; ++i) { keys[i] = prng.get(); values[i] = prng.get(); } // Encode: solve for the OKVS representation std::vector okvs(baxos.size()); baxos.solve(keys, values, okvs, &prng, 1); std::cout << "OKVS size: " << okvs.size() << " (encoding " << numItems << " items)" << std::endl; // Decode: retrieve values for specific keys std::vector decodedValues(numItems); baxos.decode(keys, decodedValues, okvs, 1); // Verify correctness for (u64 i = 0; i < numItems; ++i) { if (decodedValues[i] != values[i]) { std::cout << "Decode error at index " << i << std::endl; } } std::cout << "All values decoded correctly" << std::endl; // Single value decode oc::block singleValue = baxos.decode(keys[0], okvs); std::cout << "Single decode: " << singleValue << std::endl; } ``` -------------------------------- ### RsCpsiSender: Implement Circuit PSI Sender Source: https://context7.com/ladnir/volepsi/llms.txt Implements the sender side of Circuit PSI, providing keys and values to be secret-shared. It initializes the protocol with set sizes, value length, and security parameters, then executes the send operation. The output includes shares of membership flags and associated values. ```cpp #include "volePSI/RsCpsi.h" #include "coproto/Socket/LocalAsyncSocket.h" void runCircuitPsiSender() { u64 senderSetSize = 1000; u64 receiverSetSize = 1000; u64 valueByteLength = sizeof(oc::block); u64 statisticalSecurityParam = 40; u64 numThreads = 1; // Generate sender's set and associated values std::vector senderSet(senderSetSize); oc::Matrix senderValues(senderSetSize, valueByteLength); oc::PRNG prng(oc::sysRandomSeed()); for (u64 i = 0; i < senderSetSize; ++i) { senderSet[i] = oc::block(0, i); // Copy set element as value (or use any associated data) std::memcpy(&senderValues(i, 0), &senderSet[i], sizeof(oc::block)); } auto sockets = coproto::LocalAsyncSocket::makePair(); volePSI::RsCpsiSender sender; sender.init(senderSetSize, receiverSetSize, valueByteLength, statisticalSecurityParam, prng.get(), numThreads, volePSI::ValueShareType::Xor); volePSI::RsCpsiSender::Sharing senderShare; // Run protocol auto proto = sender.send(senderSet, senderValues, senderShare, sockets[1]); macoro::sync_wait(proto); // senderShare.mFlagBits: sender's share of membership flags // senderShare.mValues: sender's share of the values // senderShare.mMapping: maps input indices to output table positions std::cout << "Circuit PSI sender completed" << std::endl; std::cout << "Output table size: " << senderShare.mFlagBits.size() << std::endl; } ``` -------------------------------- ### Configure CMake for volePSI Integration Source: https://github.com/ladnir/volepsi/blob/main/tests/cmakeTests/CMakeLists.txt This CMake script initializes the project, searches for the volePSI dependency, and configures build targets. It handles platform-specific compiler flags to ensure the correct C++ standard is enforced. ```cmake cmake_minimum_required(VERSION 3.15) project(cmakeTests) if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) SET(CMAKE_BUILD_TYPE Release) endif() find_package(volePSI REQUIRED HINTS ${VOLEPSI_HINT}) add_executable(main "main.cpp") if(MSVC) set_target_properties(main PROPERTIES CXX_STANDARD ${VOLE_PSI_STD_VER} CXX_STANDARD_REQUIRED YES CXX_EXTENSIONS NO ) else() target_compile_options(main PRIVATE "-std=c++${VOLE_PSI_STD_VER}" ) endif() target_link_libraries(main visa::volePSI) ``` -------------------------------- ### Run VolePSI Sender with TLS Encryption Source: https://context7.com/ladnir/volepsi/llms.txt Executes the VolePSI sender with TLS encryption enabled for secure communication. This requires specifying the sender's input file, role (0), and providing paths to the Certificate Authority (CA) certificate, public certificate, and private key. ```bash ./out/build/linux/frontend/frontend \ -in sender_set.csv \ -r 0 \ -tls \ -CA /path/to/ca.cert.pem \ -pk /path/to/public.cert.pem \ -sk /path/to/private.key.pem \ -ip localhost:1212 ``` -------------------------------- ### Configure volePSI_Tests Library Build Source: https://github.com/ladnir/volepsi/blob/main/tests/CMakeLists.txt This CMake script defines the source files for the volePSI_Tests library, conditionally includes optional modules like GMW, CPSI, and OPPRF, and configures compiler standards for MSVC and other compilers. ```cmake set(SRCS "Paxos_Tests.cpp" "RsOprf_Tests.cpp" "RsPsi_Tests.cpp" "UnitTests.cpp" "FileBase_Tests.cpp" ) if(VOLE_PSI_ENABLE_GMW) list(APPEND SRCS "GMW_Tests.cpp" ) endif() if(VOLE_PSI_ENABLE_CPSI) list(APPEND SRCS "RsCpsi_Tests.cpp" ) endif() if(VOLE_PSI_ENABLE_OPPRF) list(APPEND SRCS "RsOpprf_Tests.cpp" ) endif() add_library(volePSI_Tests ${SRCS}) target_link_libraries(volePSI_Tests volePSI) if(MSVC) target_compile_options(volePSI_Tests PRIVATE $<$:/std:c++${VOLE_PSI_STD_VER}>) else() target_compile_options(volePSI_Tests PRIVATE $<$:-std=c++${VOLE_PSI_STD_VER}>) endif() ``` -------------------------------- ### Run Standard PSI Receiver Protocol (C++) Source: https://context7.com/ladnir/volepsi/llms.txt Implements the receiver side of the standard Private Set Intersection protocol. The receiver learns the intersection of elements present in both their set and the sender's set. After protocol completion, the intersection is available as indices into the receiver's input set. Requires initialization and a Coproto socket connection. ```cpp #include "volePSI/RsPsi.h" #include "coproto/Socket/AsioSocket.h" void runPsiReceiver() { // Configuration u64 senderSetSize = 10000; u64 receiverSetSize = 10000; u64 statisticalSecurityParam = 40; bool maliciousSecurity = false; u64 numThreads = 1; // Generate receiver's set std::vector receiverSet(receiverSetSize); oc::PRNG prng(oc::sysRandomSeed()); for (u64 i = 0; i < receiverSetSize; ++i) { receiverSet[i] = oc::block(0, i); } // Connect as server coproto::Socket socket = coproto::asioConnect("localhost:1212", true); // Initialize and run receiver protocol volePSI::RsPsiReceiver receiver; receiver.setMultType(oc::DefaultMultType); receiver.init(senderSetSize, receiverSetSize, statisticalSecurityParam, prng.get(), maliciousSecurity, numThreads); macoro::sync_wait(receiver.run(receiverSet, socket)); // Access intersection results (indices into receiverSet) std::cout << "Intersection size: " << receiver.mIntersection.size() << std::endl; for (u64 idx : receiver.mIntersection) { std::cout << "Element at index " << idx << ": " << receiverSet[idx] << std::endl; } } ``` -------------------------------- ### Run VolePSI Sender with Malicious Security Source: https://context7.com/ladnir/volepsi/llms.txt Executes the VolePSI sender with malicious security enabled. This ensures protection against malicious adversaries during the PSI protocol. It requires the input sender set, role as sender (0), and communication parameters. ```bash ./out/build/linux/frontend/frontend \ -in sender_set.csv \ -r 0 \ -malicious \ -ip localhost:1212 ``` -------------------------------- ### RsCpsiReceiver: Implement Circuit PSI Receiver Source: https://context7.com/ladnir/volepsi/llms.txt Implements the receiver side of Circuit PSI. It initializes the protocol with similar parameters as the sender and executes the receive operation. The output includes shares of membership flags and a mapping to reconstruct the intersection when combined with the sender's shares. ```cpp #include "volePSI/RsCpsi.h" #include "coproto/Socket/LocalAsyncSocket.h" void runCircuitPsiReceiver() { u64 senderSetSize = 1000; u64 receiverSetSize = 1000; u64 valueByteLength = sizeof(oc::block); u64 statisticalSecurityParam = 40; u64 numThreads = 1; std::vector receiverSet(receiverSetSize); oc::PRNG prng(oc::sysRandomSeed()); for (u64 i = 0; i < receiverSetSize; ++i) { receiverSet[i] = oc::block(0, i); } auto sockets = coproto::LocalAsyncSocket::makePair(); volePSI::RsCpsiReceiver receiver; receiver.init(senderSetSize, receiverSetSize, valueByteLength, statisticalSecurityParam, prng.get(), numThreads, volePSI::ValueShareType::Xor); volePSI::RsCpsiReceiver::Sharing receiverShare; auto proto = receiver.receive(receiverSet, receiverShare, sockets[0]); macoro::sync_wait(proto); // Reconstruct intersection from shares (requires combining with sender's share) // receiverShare.mFlagBits XOR senderShare.mFlagBits = 1 for intersection elements // receiverShare.mMapping[i] gives output position for input element i std::cout << "Circuit PSI receiver completed" << std::endl; for (u64 i = 0; i < receiverSetSize; ++i) { u64 outputIdx = receiverShare.mMapping[i]; // Flag bit indicates if element is in intersection (when XORed with sender's) bool myFlagShare = receiverShare.mFlagBits[outputIdx]; std::cout << "Input " << i << " maps to output " << outputIdx << ", flag share: " << myFlagShare << std::endl; } } ``` -------------------------------- ### RsOprfSender: Oblivious PRF Sender Implementation Source: https://context7.com/ladnir/volepsi/llms.txt Implements the sender side of the Oblivious Pseudo-Random Function (OPRF) protocol. After the protocol completes, the sender can evaluate the OPRF on any input using the eval() method for single or batch evaluations. Requires coproto for socket communication. ```cpp #include "volePSI/RsOprf.h" #include "coproto/Socket/LocalAsyncSocket.h" void runOprfSender() { u64 numItems = 10000; u64 numThreads = 1; bool reducedRounds = false; auto sockets = coproto::LocalAsyncSocket::makePair(); oc::PRNG prng(oc::sysRandomSeed()); volePSI::RsOprfSender oprfSender; oprfSender.mSsp = 40; // Statistical security parameter oprfSender.setMultType(oc::DefaultMultType); // Run OPRF protocol auto proto = oprfSender.send(numItems, prng, sockets[1], numThreads, reducedRounds); macoro::sync_wait(proto); // After protocol, sender can evaluate OPRF on any input std::vector inputs = {oc::block(0, 1), oc::block(0, 2), oc::block(0, 3)}; std::vector outputs(inputs.size()); // Single evaluation oc::block singleOutput = oprfSender.eval(inputs[0]); // Batch evaluation oprfSender.eval(inputs, outputs, numThreads); std::cout << "OPRF evaluation results:" << std::endl; for (u64 i = 0; i < inputs.size(); ++i) { std::cout << "F(" << inputs[i] << ") = " << outputs[i] << std::endl; } } ``` -------------------------------- ### Output Indices Instead of Elements Source: https://context7.com/ladnir/volepsi/llms.txt Configures the VolePSI receiver to output the indices of the intersection elements rather than the elements themselves. This is useful when only the positions of matching elements are needed. Requires input receiver set, role as receiver (1), and an output file for indices. ```bash ./out/build/linux/frontend/frontend \ -in receiver_set.csv \ -r 1 \ -indexSet \ -out indices.csv ``` -------------------------------- ### RsOprfReceiver: Oblivious PRF Receiver Implementation Source: https://context7.com/ladnir/volepsi/llms.txt Implements the receiver side of the Oblivious Pseudo-Random Function (OPRF) protocol. The receiver provides input values and obtains the OPRF evaluations without the sender learning the inputs. Requires coproto for socket communication. ```cpp #include "volePSI/RsOprf.h" #include "coproto/Socket/LocalAsyncSocket.h" void runOprfReceiver() { u64 numThreads = 1; bool reducedRounds = false; // Receiver's input values std::vector inputs = { oc::block(0, 100), oc::block(0, 200), oc::block(0, 300) }; std::vector outputs(inputs.size()); auto sockets = coproto::LocalAsyncSocket::makePair(); oc::PRNG prng(oc::sysRandomSeed()); volePSI::RsOprfReceiver oprfReceiver; oprfReceiver.mSsp = 40; oprfReceiver.setMultType(oc::DefaultMultType); // Run OPRF protocol - receiver gets F(inputs[i]) for each input auto proto = oprfReceiver.receive(inputs, outputs, prng, sockets[0], numThreads, reducedRounds); macoro::sync_wait(proto); std::cout << "OPRF receiver outputs:" << std::endl; for (u64 i = 0; i < inputs.size(); ++i) { std::cout << "F(" << inputs[i] << ") = " << outputs[i] << std::endl; } } ``` -------------------------------- ### RsCpsiSender - Circuit PSI Sender Source: https://context7.com/ladnir/volepsi/llms.txt Implements the sender side of the Circuit PSI protocol. The sender provides keys and associated values that will be secret-shared. The intersection result is secret-shared between parties. ```APIDOC ## RsCpsiSender - Circuit PSI Sender ### Description Implements the sender side of the Circuit PSI protocol, where the intersection result is secret-shared between parties rather than revealed. This enables further secure computation on the intersection. The sender provides both keys and associated values that will be secret-shared. ### Method N/A (This is a class implementation, not a direct API endpoint) ### Endpoint N/A ### Parameters N/A (Class initialization and method parameters are detailed in the code) ### Request Example N/A ### Response N/A #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### RsCpsiReceiver - Circuit PSI Receiver Source: https://context7.com/ladnir/volepsi/llms.txt Implements the receiver side of the Circuit PSI protocol. After the protocol, both parties hold shares of a flag vector (indicating membership) and value vector that can be used in subsequent secure computation. ```APIDOC ## RsCpsiReceiver - Circuit PSI Receiver ### Description Implements the receiver side of the Circuit PSI protocol. After the protocol, both parties hold shares of a flag vector (indicating membership) and value vector that can be used in subsequent secure computation. ### Method N/A (This is a class implementation, not a direct API endpoint) ### Endpoint N/A ### Parameters N/A (Class initialization and method parameters are detailed in the code) ### Request Example N/A ### Response N/A #### Success Response (200) N/A #### Response Example N/A ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.