Big News: Socket Selected for OpenAI's Cybersecurity Grant Program.Details
Socket
Book a DemoSign in
Socket

paillier-in-set-zkp

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

paillier-in-set-zkp

Generate a zero knowledge proof that an encrypted number is in a set

latest
Source
npmnpm
Version
0.9.0
Version published
Maintainers
1
Created
Source

paillier-in-set-zkp

Encrypt a value and generates a Zero Knowledge Proof that can be used to verify that the encrypted value is inside a set of known values.

Based on this paper.

Installation

npm i paillier-in-set-zkp --save

Usage

const { encryptWithProof, verifyProof } = require('paillier-in-set-zkp')
const paillier = require('paillier-js')

const bits = 512

const {publicKey, privateKey} = paillier.generateRandomKeys(bits)
const validScores = [0,15,30,60]
const secretScore = 30

const [cipher, proof] = encryptWithProof(publicKey, secretScore, validScores, bits)

// Transmit cipher, proof and publicKey

const result = verifyProof(publicKey, cipher, proof, validScores, bits) // true

Contributions

Bug reports highly appreciated

PRs super welcome

Tests

Tests live in the index file in the shape of a bunch of asserts.

Tests get removed automatically at postinstall using sed.

License

MIT

Keywords

zero knowledge

FAQs

Package last updated on 09 Sep 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts