OpenHushed is a comprehensive post-quantum privacy computing framework that integrates three core components for secure multi-party computation, homomorphic encryption, and high-performance communication. The framework is designed to provide quantum-resistant cryptographic solutions for privacy-preserving computations.
OpenHushed consists of three main components:
- Purpose: Advanced homomorphic encryption operations with post-quantum security
- Features:
- Microsoft SEAL-based homomorphic encryption (BGV/BFV schemes)
- Lattice-based cryptographic primitives
- Batch encoding and SIMD operations
- Key generation and management
- Polynomial arithmetic and evaluation
- Location:
Haven/
- Purpose: Secure and efficient network communication for distributed protocols
- Features:
- TCP/UDP transport layers with Boost.Asio
- Message serialization with FlatBuffers
- Batch messaging and large file transfers
- Asynchronous communication patterns
- Fiber-based concurrency support
- Location:
Wormhole/
- Purpose: Privacy-preserving linear and non-linear computations
- Features:
- Matrix multiplication protocols (CMatMul, SMatMul)
- Comparison protocols with millionaire's problem
- Non-linear activation functions (GeLU, ReLU)
- Linear layer computations for neural networks
- OpenMP parallelization for performance
- Integration with Haven and Wormhole
- Location:
OpenHushed/
The following dependencies are required for building OpenHushed:
# Ubuntu/Debian
sudo apt update
sudo apt install -y \
build-essential cmake git pkg-config \
libgmp-dev libmpfr-dev \
libflint-dev \
libfmt-dev \
libomp-dev \
flatbuffers-compiler libflatbuffers-dev \
libgtest-dev# Install Microsoft SEAL (required for homomorphic encryption)
wget https://github.com/microsoft/SEAL/releases/download/v4.1.1/SEAL-4.1.1.tar.gz
tar -xzf SEAL-4.1.1.tar.gz
cd SEAL-4.1.1
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --parallel $(nproc)
sudo cmake --install build
cd ..
rm -rf SEAL-4.1.1*# Install HElib for additional homomorphic encryption support
git clone https://github.com/homenc/HElib.git
cd HElib
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j$(nproc)
sudo make install
cd ../..
rm -rf HElib# Install NTL (required by HElib)
wget https://libntl.org/ntl-11.5.1.tar.gz
tar -xzf ntl-11.5.1.tar.gz
cd ntl-11.5.1/src
./configure PREFIX=/usr/local
make -j$(nproc)
sudo make install
cd ../..
rm -rf ntl-11.5.1*# Download and build Boost 1.88
wget https://boostorg.jfrog.io/artifactory/main/release/1.88.0/source/boost_1_88_0.tar.gz
tar -xzf boost_1_88_0.tar.gz
cd boost_1_88_0
./bootstrap.sh
./b2 --with-system --with-thread --with-fiber --with-context --with-log --with-filesystem
cd ..
# Move to OpenHushed third-party directory
mv boost_1_88_0 OpenHushed/third/
rm boost_1_88_0.tar.gz# Clone the repository
git clone <repository-url>
cd OpenHushed
# Ensure Boost is in the correct location
# (If you followed the prerequisites, boost_1_88_0 should be in third/)
# Build all components
mkdir build && cd build
cmake ..
cmake --build . --parallel $(nproc)
# Or build specific components
cmake -DBUILD_HAVEN=ON -DBUILD_WORMHOLE=OFF -DBUILD_OPENHUSHED=OFF ..
cmake --build . --parallel $(nproc)| Option | Default | Description |
|---|---|---|
BUILD_HAVEN |
ON | Build Haven homomorphic encryption library |
BUILD_WORMHOLE |
ON | Build Wormhole communication library |
BUILD_OPENHUSHED |
ON | Build OpenHushed MPC library |
BUILD_TESTS |
ON | Build test suites |
BUILD_DEMOS |
OFF | Build demonstration applications |
USE_SPU |
OFF | Enable SPU integration for advanced protocols |
// Parameter Setup
Params params(64);
params.ShowParams();
// Key-generation
KGC c(params, 64);
auto public_key = c.GetPk();
// 2-out-of-2 additive shares
SkShare s0(params), s1(params);
c.ShareSk(s0, s1);
// Message encryptions
uint64_t m1 = 40;
uint64_t m2 = 50;
uint64_t m3 = 20;
HSSCtxt ct1(params), ct2(params), ct3(params);
HSSEncrypt(public_key, m1, ct1);
HSSEncrypt(public_key, m2, ct2);
HSSEncrypt(public_key, m3, ct3);
// Get PRF key from kgc
std::string prf_key = c.GetPRFKey();
// Evaluator 0 operations
SkShare t0_out(params);
{
SkShare t0(params);
Evaluator e0(public_key, s0, params, prf_key, 0); // party_index = 0
e0.ConvHSSCtxtToShare(ct1, t0);
clock_t start = clock();
e0.MultHSSCtxtAndShare(ct2, t0, t0_out);
clock_t end = clock();
double duration_ms = (end - start) * 1000.0 / CLOCKS_PER_SEC;
std::cout << "ε½ζ°θΏθ‘ζΆι΄: " << duration_ms << " ζ―«η§" << std::endl;
e0.ConvHSSCtxtToShare(ct3, t0);
e0.AddShares(t0, t0_out);
}
// Evaluator 1 operations
SkShare t1_out(params);
{
Evaluator e1(public_key, s1, params, prf_key, 1); // party_index = 1
SkShare t1(params);
e1.ConvHSSCtxtToShare(ct1, t1);
e1.MultHSSCtxtAndShare(ct2, t1, t1_out);
e1.ConvHSSCtxtToShare(ct3, t1);
e1.AddShares(t1, t1_out);
}
uint64_t res;
ReconstShares(t0_out, t1_out, res);#include "wormhole/communication/communication_layer.h"
// Setup communication
wormhole::CommunicationLayer comm("localhost", 8080);
comm.connect();
// Send/receive messages
comm.send_message("Hello, secure world!");
auto response = comm.receive_message();#include "openhushed/linear/CMatMul.h"
#include "openhushed/nonlinear/cmp.h"
// Initialize secure matrix multiplication
CMatMul matmul(rows, cols, comm_layer);
// Preprocessing phase
matmul.PreprocessingPhase();
// Online computation
auto result = matmul.OnlinePhase(input_matrix);
// Secure comparison
ComparisonProtocol cmp(context, bit_length, secret_key);
auto comparison_result = cmp.compare_two_party(x_share, y_share, x1_share, y1_share);# Run all tests
cd build
ctest
# Run specific component tests
./Haven/test/test_seal_simd
./Haven/test/test_lattice
./Wormhole/demo/communication_demo
./OpenHushed/tests/test_linear
./OpenHushed/tests/test_cmp
./OpenHushed/tests/test_gelu
./OpenHushed/tests/test_smatmul
./OpenHushed/tests/test_cmatmulOpenHushed/
βββ CMakeLists.txt # Root build configuration
βββ README.md # This file
βββ Haven/ # Homomorphic secret sharing
β βββ src/crypto/ # Core crypto implementations
β βββ src/lattice/ # Lattice-based primitives
β βββ src/utils/ # Utility functions
β βββ test/ # Unit tests
βββ Wormhole/ # Communication layer
β βββ src/communication/ # Network protocols
β βββ src/utility/ # Utility functions
β βββ fbs/ # FlatBuffer schemas
β βββ demo/ # Example applications
βββ OpenHushed/ # Secure computation
β βββ src/linear/ # Linear algebra protocols
β βββ src/nonlinear/ # Non-linear operations
β βββ tests/ # Integration tests
βββ third/ # Third-party dependencies
βββ boost_1_88_0/ # Boost libraries
βββ flatbuffers/ # Serialization
βββ spu/ # SPU integration (optional)
βββ yacl/ # Yet Another Crypto Library
- GMP/GMPXX: Arbitrary precision arithmetic
- FLINT: Fast Library for Number Theory
- NTL: Number Theory Library
- Microsoft SEAL 4.1: Homomorphic encryption
- HElib: Alternative homomorphic encryption
- Boost 1.88: System utilities, threading, fiber, context
- FlatBuffers: Efficient serialization
- OpenMP: Parallel computing
- Threading: Multi-threading support
- GTest: Unit testing framework
- CMake: Build system
- pkg-config: Package configuration
- Code Style: Follow the existing C++17 style with PIMPL pattern
- Testing: Add comprehensive tests for new features
- Documentation: Update relevant documentation
- Performance: Profile critical paths and optimize
- Security: Follow cryptographic best practices
# Debug build
cmake -DCMAKE_BUILD_TYPE=Debug ..
make -j$(nproc)
# Run with debugging
gdb ./OpenHushed/tests/test_cmp
# Memory checking
valgrind --tool=memcheck ./OpenHushed/tests/test_linearOpenHushed is designed with post-quantum security in mind:
- Lattice-based cryptography: Resistant to quantum attacks
- Ring Learning With Errors (RLWE): Foundation for homomorphic encryption
- BGV/BFV schemes: Quantum-resistant homomorphic encryption
- Secure multi-party protocols: Information-theoretic security
- Haven: See
Haven/doc/for homomorphic encryption details - Wormhole: Communication protocol specifications
- OpenHushed: MPC algorithm implementations and optimizations
- Microsoft SEAL: MIT License
- HElib: Apache License 2.0
- Boost: Boost Software License
- FLINT: LGPL 2.1+
- NTL: LGPL 2.1+
- GMP: LGPL 3.0+
- FlatBuffers: Apache License 2.0
This project is licensed under the [Apache License 2.0] - see the LICENSE file for details.
- Microsoft SEAL team for quantum-resistant homomorphic encryption
- HElib developers for advanced homomorphic encryption primitives
- Boost community for high-quality C++ libraries
- FLINT and NTL developers for number theory algorithms
- Google FlatBuffers team for efficient serialization
- OpenMP community for parallel computing standards
For questions, issues, or contributions:
- π Issues: GitHub Issues
- π¬ Discussions: GitHub Discussions
- π§ Email: cryptographer63@126.com
OpenHushed - Post-Quantum Privacy Computing for the Future π