A reference library for the qCrypt implementation of Fully Homomorphic Encryption (FHE) by Craig Gentry. Built for qCrypt.
npm install fhe
This library is intended for educational purposes ONLY and is NOT suitable for production use.
// Optionally, pass in an object to the constructor to set custom FHE paramsvar fhe = ;// Simple explainer for the FHE parameters// (debug purposes)fhe;// Run a test encryption / decryption bit cycle// This method returns a boolean as a result// true === success// false === something went wrongconsole;
For custom implementations
// Generate a keypair (public key and private key)var keyPair = fhe;// Encrypt a bitvar bit = 1;var ciphertext = fhe;// Decrypt the bitvar decrypted = fhe;// Verify the decrypted bit is the same as the originalconsole;
- genKeyPair ( )
- Returns an object containing secret and public parameters
- genSecret ( )
- genPublic ( secret )
- getD ( secret )
- getRem ( a, b )
- encryptBit ( public, bit )
- decryptBit ( secret, ciphertext )