Project

NetInt

Overview

NetInt is a secure multi-party computation (MPC) library for C++ developed in an academic research setting under a U.S. Department of Energy fellowship. It enables privacy-preserving integer computation. Programs written with NetInt can perform arithmetic and comparisons without revealing raw values to any single participant. The library uses a primary script that coordinates work across multiple agents over a socket-based protocol.

Design

NetInt follows a primary–agent architecture. A primary process runs the target program, while three agents connect to participate in secure evaluation of operations. Network access can be restricted using IP whitelisting, and message verbosity can be suppressed for cleaner output. The interface is intentionally lightweight: replacing standard integers with NetInt allows many existing C++ programs to run with minimal structural changes.

  • Secure integer type: addition, subtraction, multiplication, comparisons.
  • Socket protocol: agents connect to the primary on a chosen port.
  • Controls: optional message suppression and IP whitelist.
  • Repo layout: standalone implementations for easier debugging and testing.

Implementation

The core implementation lives in NetInt.h and the agent communication logic in agent.c. Sample programs demonstrate library usage on real algorithms and workflows.

Build

make

Library usage

  1. Copy NetInt.h (and the openssl/ folder) into your project.
  2. Include the header: #include "NetInt.h"
  3. (Optional) hideMessages(true);
  4. (Optional) setWhitelist({"IP1","IP2"});
  5. Establish the port before declaring any NetInt variables: establishPort("8081");

Run

Start the primary program (example):

./sample

Then connect three agents:

./agent <primary-ip> <port>

Local testing:

./agent 127.0.0.1 <port>

Final Deployment

The final deliverable is a header-based C++ library plus agent binaries and example programs. The repository also includes standalone versions intended to make development and debugging easier before integrating changes into the library.

File structure

  • NetInt.h — Secure integer type and MPC context
  • agent.c — Agent communication logic
  • sample.cpp, sample2.cpp, sample3.cpp — Example applications
  • Makefile — Build instructions
  • Local Standalone/ — Object-oriented crypto function implementations
  • Networked Standalone/ — Server-like networked implementation for testing

Possible improvements

  • Replace rand() with a cryptographically secure RNG.
  • Improve negative number handling (see sample3).
  • Add secure division.
  • Add secure modulo.
  • Store values as share arrays rather than raw values to reduce split/reconstruct cycles (tradeoff: reconstruction needed when returning raw values).

Repository

Checkout the current state of the project on GitHub.

NetInt on GitHub