@safeheron/crypto-paillier
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

crypto-paillier-js

Installation

npm install @safeheron/crypto-paillier

Import the library in code:

import * as assert from "assert"
import * as BN from "bn.js"
import {Rand} from '@safeheron/crypto-rand'
import {PailPrivKey, PailPubKey, createPailKeyPair} from "@safeheron/crypto-paillier"

Examples

Encrypt and Decrypt

let m = await Rand.randomBNLt(pub.n)
let r = await Rand.randomBNLtGCD(pub.n)
let c = await pub.encryptWithR(m, r)
let expected = await priv.decrypt(c)
assert(m.eq(expected), "should equal")

Package Sidebar

Install

npm i @safeheron/crypto-paillier

Weekly Downloads

35

Version

1.0.0

License

none

Unpacked Size

27 kB

Total Files

9

Last publish

Collaborators

  • safeheron-yanjie
  • max_safeheron