Skip to content

Javascript implementation of the Paillier additive homomorphic cryptosystem

License

Notifications You must be signed in to change notification settings

louismullie/hom-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Paillier JS

A Javascript implementation of the Paillier cryptosystem, invented by Pascal Pailler in 1999. The Paillier cryptosystem is an additive homomorphic system, meaning that given only the public-key and the encryption of m1 and m2, one can compute the encryption of m1 + m2.

Usage

** Addition**

var keys = Paillier.generateKeys(1024);

var encA = keys.pub.encrypt(7891),
    encB = keys.pub.encrypt(3456);

var encSum = keys.pub.add(encA, encB),
    decSum = keys.sec.decrypt(encSum);

// decSum is equal to 11347

Multiplication

var keys = Paillier.generateKeys(1024);

var encA = keys.pub.encrypt(7891);

var encMul = keys.pub.mult(encA, 3456),
    decMul = keys.sec.decrypt(encMul);

// decMul is equal to 27271296

Dependencies

Depends on sjcl.js and jsbn.js (included in this repository under the lib/ folder).

License

This code is licensed under the GPL v3.

About

Javascript implementation of the Paillier additive homomorphic cryptosystem

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published