paillier-bigint
Advanced tools
Comparing version 1.0.5 to 1.0.7
@@ -808,3 +808,3 @@ var paillierBigint = (function (exports) { | ||
* | ||
* @param {...bigints} - 2 or more (big) numbers (m_1,..., m_n) encrypted with this public key | ||
* @param {...bigint | ...number} - n >= 2 ciphertexts (c_1,..., c_n) that are the encryption of (m_1, ..., m_n) with this public key | ||
* | ||
@@ -818,3 +818,3 @@ * @returns {bigint} - the encryption of (m_1 + ... + m_2) with this public key | ||
/** | ||
* Pseudo-homomorphic paillier multiplication | ||
* Pseudo-homomorphic Paillier multiplication | ||
* | ||
@@ -824,3 +824,3 @@ * @param {bigint} c - a number m encrypted with this public key | ||
* | ||
* @returns {bigint} - the ecnryption of k·m with this public key | ||
* @returns {bigint} - the encryption of k·m with this public key | ||
*/ | ||
@@ -827,0 +827,0 @@ multiply(c, k) { // c is ciphertext. k is either a cleartext message (number) or a scalar |
@@ -805,3 +805,3 @@ const _ZERO = BigInt(0); | ||
* | ||
* @param {...bigints} - 2 or more (big) numbers (m_1,..., m_n) encrypted with this public key | ||
* @param {...bigint | ...number} - n >= 2 ciphertexts (c_1,..., c_n) that are the encryption of (m_1, ..., m_n) with this public key | ||
* | ||
@@ -815,3 +815,3 @@ * @returns {bigint} - the encryption of (m_1 + ... + m_2) with this public key | ||
/** | ||
* Pseudo-homomorphic paillier multiplication | ||
* Pseudo-homomorphic Paillier multiplication | ||
* | ||
@@ -821,3 +821,3 @@ * @param {bigint} c - a number m encrypted with this public key | ||
* | ||
* @returns {bigint} - the ecnryption of k·m with this public key | ||
* @returns {bigint} - the encryption of k·m with this public key | ||
*/ | ||
@@ -824,0 +824,0 @@ multiply(c, k) { // c is ciphertext. k is either a cleartext message (number) or a scalar |
@@ -93,3 +93,3 @@ 'use strict'; | ||
* | ||
* @param {...bigints} - 2 or more (big) numbers (m_1,..., m_n) encrypted with this public key | ||
* @param {...bigint | ...number} - n >= 2 ciphertexts (c_1,..., c_n) that are the encryption of (m_1, ..., m_n) with this public key | ||
* | ||
@@ -103,3 +103,3 @@ * @returns {bigint} - the encryption of (m_1 + ... + m_2) with this public key | ||
/** | ||
* Pseudo-homomorphic paillier multiplication | ||
* Pseudo-homomorphic Paillier multiplication | ||
* | ||
@@ -109,3 +109,3 @@ * @param {bigint} c - a number m encrypted with this public key | ||
* | ||
* @returns {bigint} - the ecnryption of k·m with this public key | ||
* @returns {bigint} - the encryption of k·m with this public key | ||
*/ | ||
@@ -112,0 +112,0 @@ multiply(c, k) { // c is ciphertext. k is either a cleartext message (number) or a scalar |
{ | ||
"name": "paillier-bigint", | ||
"version": "1.0.5", | ||
"version": "1.0.7", | ||
"description": "An implementation of the Paillier cryptosystem using native JS (stage 3) implementation of BigInt", | ||
@@ -41,4 +41,4 @@ "keywords": [ | ||
"rollup-plugin-babel-minify": "^8.0.0", | ||
"rollup-plugin-commonjs": "^9.3.4", | ||
"rollup-plugin-node-resolve": "^4.2.4", | ||
"rollup-plugin-commonjs": "^10.0.0", | ||
"rollup-plugin-node-resolve": "^5.0.0", | ||
"rollup-plugin-replace": "^2.2.0", | ||
@@ -45,0 +45,0 @@ "rollup-plugin-multi-entry": "^2.1.0" |
@@ -53,5 +53,5 @@ # bigint-paillier | ||
3. Compute `λ = lcm(p-1, q-1)` with `lcm(a, b) = a·b / gcd(a, b)`. | ||
4. Select generator `g` where in Z* of `n^2`. `g` can be computed as follows (there are other ways): | ||
* Generate randoms `α` and `β` in Z* of n (i.e. `0<α<n` and `0<β<n`). | ||
* Compute `g=( α·n + 1 ) β^n mod n^2` | ||
4. Select a generator `g` in `Z*` of `n^2`. `g` can be computed as follows (there are other ways): | ||
* Generate randoms `α` and `β` in `Z*` of `n`. | ||
* Compute `g=( α·n + 1 ) β^n mod n^2`. | ||
5. Compute `μ=( L( g^λ mod n^2 ) )^(-1) mod n` where `L(x)=(x-1)/n`. | ||
@@ -64,12 +64,12 @@ | ||
## Encryption | ||
Let `m` in Z* of `n` be the clear-text message, | ||
Let `m` in `Z*` of `n` be the clear-text message, | ||
1. Select random `r` in Z* of `n^2`. | ||
1. Select random integer `r` in `(1, n^2)`. | ||
2. Compute ciphertext as: **`c=g^m · r^n mod n^2`** | ||
2. Compute ciphertext as: **`c = g^m · r^n mod n^2`** | ||
## Decryption | ||
Let `c` be the ciphertext to decrypt, where `c` in Z* of `n^2`. | ||
Let `c` be the ciphertext to decrypt, where `c` in `(0, n^2)`. | ||
1. Compute the plaintext message as: **`m=L( c^λ mod n^2 ) · μ mod n`** | ||
1. Compute the plaintext message as: **`m = L( c^λ mod n^2 ) · μ mod n`** | ||
@@ -238,3 +238,3 @@ ## Installation | ||
| --- | --- | --- | | ||
| ...ciphertexts | <code>bigints</code> | 2 or more (big) numbers (m_1,..., m_n) encrypted with this public key | | ||
| ...ciphertexts | <code>bigint</code> \| <code>number</code> | n >= 2 ciphertexts (c_1,..., c_n) that are the encryption of (m_1, ..., m_n) with this public key | | ||
@@ -244,6 +244,6 @@ <a name="PublicKey+multiply"></a> | ||
### publicKey.multiply(c, k) ⇒ <code>bigint</code> | ||
Pseudo-homomorphic paillier multiplication | ||
Pseudo-homomorphic Paillier multiplication | ||
**Kind**: instance method of [<code>PublicKey</code>](#PublicKey) | ||
**Returns**: <code>bigint</code> - - the ecnryption of k·m with this public key | ||
**Returns**: <code>bigint</code> - - the encryption of k·m with this public key | ||
@@ -373,3 +373,3 @@ | Param | Type | Description | | ||
| --- | --- | --- | | ||
| ...ciphertexts | <code>bigints</code> | 2 or more (big) numbers (m_1,..., m_n) encrypted with this public key | | ||
| ...ciphertexts | <code>bigint</code> \| <code>number</code> | n >= 2 ciphertexts (c_1,..., c_n) that are the encryption of (m_1, ..., m_n) with this public key | | ||
@@ -379,6 +379,6 @@ <a name="PublicKey+multiply"></a> | ||
### publicKey.multiply(c, k) ⇒ <code>bigint</code> | ||
Pseudo-homomorphic paillier multiplication | ||
Pseudo-homomorphic Paillier multiplication | ||
**Kind**: instance method of [<code>PublicKey</code>](#PublicKey) | ||
**Returns**: <code>bigint</code> - - the ecnryption of k·m with this public key | ||
**Returns**: <code>bigint</code> - - the encryption of k·m with this public key | ||
@@ -385,0 +385,0 @@ | Param | Type | Description | |
@@ -90,3 +90,3 @@ 'use strict'; | ||
* | ||
* @param {...bigints} - 2 or more (big) numbers (m_1,..., m_n) encrypted with this public key | ||
* @param {...bigint | ...number} - n >= 2 ciphertexts (c_1,..., c_n) that are the encryption of (m_1, ..., m_n) with this public key | ||
* | ||
@@ -100,3 +100,3 @@ * @returns {bigint} - the encryption of (m_1 + ... + m_2) with this public key | ||
/** | ||
* Pseudo-homomorphic paillier multiplication | ||
* Pseudo-homomorphic Paillier multiplication | ||
* | ||
@@ -106,3 +106,3 @@ * @param {bigint} c - a number m encrypted with this public key | ||
* | ||
* @returns {bigint} - the ecnryption of k·m with this public key | ||
* @returns {bigint} - the encryption of k·m with this public key | ||
*/ | ||
@@ -109,0 +109,0 @@ multiply(c, k) { // c is ciphertext. k is either a cleartext message (number) or a scalar |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
131030