npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-hcrypt

v0.0.8

Published

Fully homomorphic encryption implementation for node.js

Downloads

6

Readme

hcrypt

Fully homomorphic encryption implementation for node.js

This package provides an API for node.js application to use homomorphic encryption to perform some computations.

Only integers are currently supported.

Operations supported: algebraic addition and multiplication.


Prerequisites

You must have GMP (5.0.0+ or MPIR 2.6.0+) and MPFR (3.0.0+) libraries installed in the system. Also, build tools are required for the native addon.

For Debian-based: sudo apt-get install libgmp-dev libmpfr-dev libmpfr4 gcc g++ automake autoconf

For RHEL-based: sudo yum install gmp mpfr gcc gcc-c++ automake autoconf, but note that gmp and mpfr versions in the repo are outdated so you should just compile them from sources.

On Windows you can use cygwin, just don't forget to set GMP and MPFR to devel while installing.

This package should work with latest stable npm and node, but may also work with any below. If you run into any problems while installing be sure to udpate npm first.

MPFR: http://www.mpfr.org/mpfr-current/#download GMP: https://gmplib.org/#DOWNLOAD


To Install

npm install node-hcrypt

The installation may take a while.


API

The module exports two main object types: Crypto and Operator. Crypto provides with encrypting / decrypting functionality while Operator deals with the operations on encrypted data. Module also exports helpers for converting any arbitrary numbers and performing operations with them, but they will be integrated into the mentioned above object types soon.

Crypto
var hcrypt = require('node-hcrypt');

var crypto = new hcrypt.Crypto();
Methods

| Method | Description | | ---- | ----- | | encrypt(int bit):string | Encrypts 1 or 0. Returns encrypted value as a base64 string. | | decrypt(string encrypted):int | Decrypts. Returns 1 or 0. | | export():object | Returns public key for use with Operator. |

Operator
var hcrypt = require('node-hcrypt');

var crypto = new hcrypt.Crypto();

var operator = new hcrypt.Operator(crypto.export());
Methods

| Method | Description | | ---- | ----- | | add(string encryptedA, string encryptedB):string encryptedC | Performs logical addition. | | mul(string encryptedA, string encryptedB):string encryptedC | Performs logical multiplication. | | halfAdd(string encryptedA, string encryptedB):[string encryptedC, string carryD] | Performs half-addition with carry in return. | | fullAdd(string carryI, string encryptedA, string encryptedB):[string encryptedC, string carryD] | Performs full addition with a carry in return. | | recrypt(string encryptedI):string encryptedO | Performs cryptographic refresh. Should be done after 2-3 operations under the same encrypted value. |

Tests

WIP

License

MIT