All Projects → snipsco → rust-paillier

snipsco / rust-paillier

Licence: other
A pure-Rust implementation of the Paillier encryption scheme

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to rust-paillier

javallier
A Java library for Paillier partially homomorphic encryption.
Stars: ✭ 67 (-14.1%)
Mutual labels:  paillier, homomorphic-encryption
encrypted-geofence
testing out homomorphic encryption
Stars: ✭ 33 (-57.69%)
Mutual labels:  paillier, homomorphic-encryption
concrete
Concrete ecosystem is a set of crates that implements Zama's variant of TFHE. In a nutshell, fully homomorphic encryption (FHE), allows you to perform computations over encrypted data, allowing you to implement Zero Trust services.
Stars: ✭ 575 (+637.18%)
Mutual labels:  paillier, homomorphic-encryption
awesome-secure-computation
Awesome list for cryptographic secure computation paper. This repo includes *Lattice*, *DifferentialPrivacy*, *MPC* and also a comprehensive summary for top conferences.
Stars: ✭ 125 (+60.26%)
Mutual labels:  homomorphic-encryption, secure-computation
ecelgamal
Additive homomorphic EC-ElGamal
Stars: ✭ 19 (-75.64%)
Mutual labels:  homomorphic-encryption, secure-computation
conclave
Query compiler for secure multi-party computation.
Stars: ✭ 86 (+10.26%)
Mutual labels:  secure-computation
Seal
Microsoft SEAL is an easy-to-use and powerful homomorphic encryption library.
Stars: ✭ 2,424 (+3007.69%)
Mutual labels:  homomorphic-encryption
WeDPR-Lab-Java-SDK
Java SDK of WeDPR-Lab-Core; WeDPR即时可用场景式隐私保护高效解决方案核心算法组件通用Java SDK
Stars: ✭ 18 (-76.92%)
Mutual labels:  homomorphic-encryption
he-toolkit
The Intel Homomorphic Encryption (HE) toolkit is the primordial vehicle for the continuous distribution of the Intel HE technological innovation to users. The toolkit has been designed with usability in mind and to make it easier for users to evaluate and deploy homomorphic encryption technology on the Intel platforms.
Stars: ✭ 40 (-48.72%)
Mutual labels:  homomorphic-encryption
fully-homomorphic-encryption
Libraries and tools to perform fully homomorphic encryption operations on an encrypted data set.
Stars: ✭ 2,737 (+3408.97%)
Mutual labels:  homomorphic-encryption
tf-seal
Bridge between TensorFlow and the Microsoft SEAL homomorphic encryption library
Stars: ✭ 90 (+15.38%)
Mutual labels:  homomorphic-encryption
federated
Bachelor's Thesis in Computer Science: Privacy-Preserving Federated Learning Applied to Decentralized Data
Stars: ✭ 25 (-67.95%)
Mutual labels:  homomorphic-encryption
haal
Hääl - Anonymous Electronic Voting System on Public Blockchains
Stars: ✭ 96 (+23.08%)
Mutual labels:  homomorphic-encryption
libshe
Symmetric somewhat homomorphic encryption library based on DGHV
Stars: ✭ 24 (-69.23%)
Mutual labels:  homomorphic-encryption
MOTION
An efficient, user-friendly, modular, and extensible framework for mixed-protocol secure multi-party computation with two or more parties
Stars: ✭ 59 (-24.36%)
Mutual labels:  secure-computation
WeDPR-Lab-Android-SDK
Android SDK of WeDPR-Lab-Core; WeDPR即时可用场景式隐私保护高效解决方案核心算法组件Android SDK
Stars: ✭ 14 (-82.05%)
Mutual labels:  homomorphic-encryption
node-seal
Homomorphic Encryption for TypeScript or JavaScript - Microsoft SEAL
Stars: ✭ 139 (+78.21%)
Mutual labels:  homomorphic-encryption
WeDPR-Lab-Core
Core libraries of WeDPR instant scenario-focused solutions for privacy-inspired business; WeDPR即时可用场景式隐私保护高效解决方案核心算法组件
Stars: ✭ 147 (+88.46%)
Mutual labels:  homomorphic-encryption
minionn
Privacy -preserving Neural Networks
Stars: ✭ 58 (-25.64%)
Mutual labels:  homomorphic-encryption
emp-tool
No description or website provided.
Stars: ✭ 155 (+98.72%)
Mutual labels:  secure-computation

Paillier

Build Status Latest version License: MIT/Apache2

Efficient pure-Rust library for the Paillier partially homomorphic encryption scheme, offering encoding of both scalars and vectors (for encrypting several values together). Supports several underlying arbitrary precision libraries, including RAMP (default), GMP, and num.

Important: while we have followed recommendations regarding the scheme itself, this library should currently be seen as an experimental implementation. In particular, no particular efforts have so far been made to harden it against non-cryptographic attacks, including side-channel attacks.

extern crate paillier;
use paillier::*;

fn main() {

  // generate a fresh keypair and extract encryption and decryption keys
  let (ek, dk) = Paillier::keypair().keys();

  // select integral coding
  let code = integral::Code::default();

  // pair keys with coding
  let eek = ek.with_code(&code);
  let ddk = dk.with_code(&code);

  // encrypt four values
  let c1 = Paillier::encrypt(&eek, &10);
  let c2 = Paillier::encrypt(&eek, &20);
  let c3 = Paillier::encrypt(&eek, &30);
  let c4 = Paillier::encrypt(&eek, &40);

  // add all of them together
  let c = Paillier::add(&eek,
    &Paillier::add(&eek, &c1, &c2),
    &Paillier::add(&eek, &c3, &c4)
  );

  // multiply the sum by 2
  let d = Paillier::mul(&eek, &c, &2);

  // decrypt final result
  let m: u64 = Paillier::decrypt(&ddk, &d);
  println!("decrypted total sum is {}", m);

}

Installation

Note that some functionality is not included by default; see the Building section for more details.

GitHub

git clone https://github.com/snipsco/rust-paillier
cd rust-paillier
cargo build --release

Cargo

[dependencies]
paillier = { version="0.1" }

Building

The nightly toolchain is currently needed in order to build the library. For performance reasons we strongly encourage building and testing in release mode.

Arithmetic

The library supports the use of different arithmetic libraries, currently defaulting to RAMP for portability with good performance.

For RAMP-only compilation use cargo parameters

--no-default-features --features "inclramp defaultramp keygen"

For num-only compilation use

--no-default-features --features "inclnum defaultnum"

For GMP-only compilation use

--no-default-features --features "inclgmp defaultgmp keygen"

Finally, use

--no-default-features --features "inclramp inclnum inclgmp defaultramp"

to have one or more available, using one of them as the default (useful for e.g. performance tests).

Key generation

Key generation is optional as it is currently only implemented when using RAMP or GMP as the underlying arithmetic library.

While included by default it may be excluded using parameter

--no-default-features

in which case one or more arithmetic libraries must be specified as well as a default one, e.g.

--features "inclramp inclgmp defaultramp"

as shown in above .

Performance

Several benches are included, testing both the underlying arithmetic libraries as well as the operations of the scheme. All may be run using

cargo bench

and including either several arithmetic libraries and key generation as discussed above.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.  

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].