UNPKG

basic_simple_elgamal

Version:

This is a cypher engine which uses ElGamal cryptosystem internally. besides cryptography, it provide some group functionality such as add 2 members or select a random group member and so on.

23 lines (15 loc) 526 B
const ElGamal = require('../elgamal'); const debug = require('debug'); const bigInteger = require('big-integer'); const log = debug('app::ElGamal::Test'); async function test() { const elgamal = new ElGamal(); await elgamal.initializeRemotely(2048); elgamal.setSecurityLevel('LOW'); let g = bigInteger(elgamal.generator); let y = bigInteger(elgamal.publicKey); let p = bigInteger(elgamal.modulus); log('publicKey === modulus: ', y.equals(p)); let x = elgamal.privateKey; } test();