fhe

0.0.4 • Public • Published

node-gentry

A reference library for the qCrypt implementation of Fully Homomorphic Encryption (FHE) by Craig Gentry. Built for qCrypt.

Install

npm install fhe

Information

This library makes use of the BigInteger.js library by Peter Olson. Inspired by a Python demonstration by Christopher Swenson.

This library is intended for educational purposes ONLY and is NOT suitable for production use.

Usage

// Optionally, pass in an object to the constructor to set custom FHE params
var fhe         = require("fhe")();
 
// Simple explainer for the FHE parameters
// (debug purposes)
fhe.explainParameters();
 
// Run a test encryption / decryption bit cycle
// This method returns a boolean as a result
// true  === success
// false === something went wrong
console.log(fhe.runTest());

For custom implementations

// Generate a keypair (public key and private key)
var keyPair     = fhe.genKeyPair();
 
// Encrypt a bit
var bit = 1;
var ciphertext  = fhe.encryptBit(keyPair.public, bit);
 
// Decrypt the bit
var decrypted   = fhe.decryptBit(keyPair.secret, ciphertext);
 
// Verify the decrypted bit is the same as the original
console.log(decrypted === bit);

Method List

Initiation

Debug

Crypto

General

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.4
    5
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.4
    5
  • 0.0.3
    0
  • 0.0.2
    0

Package Sidebar

Install

npm i fhe

Weekly Downloads

5

Version

0.0.4

License

GPL

Last publish

Collaborators

  • narruc