How to use the circomlib.eddsa.prv2pub function in circomlib

To help you get started, we’ve selected a few circomlib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github barryWhiteHat / maci / app / utils / generate_circuit_input.js View on Github external
// @flow

const provingKey = require('../circuits/proving_key.json')
const verificationKey = require('../circuits/verification_key.json')
const circuitDef = require('../circuits/circuit.json')
const { eddsa, mimc7 } = require('circomlib')
const { Circuit } = require('snarkjs')
const zkSnark = require('snarkjs').original
const { unstringifyBigInts } = require('snarkjs/src/stringifybigint')

const alicePrvKey = Buffer.from('1'.toString().padStart(64, '0'), 'hex')
const alicePubKey = eddsa.prv2pub(alicePrvKey)
const bobPrvKey = Buffer.from('2'.toString().padStart(64, '0'), 'hex')
const bobPubKey = eddsa.prv2pub(bobPrvKey)

// accounts (1 = Yes, 0 = No)
const Alice = {
  pubkey: alicePubKey,
  detail: 1
}

const aliceHash = mimc7.multiHash(
  [Alice.pubkey[0], Alice.pubkey[1], BigInt(Alice.detail)]
)

const Bob = {
  pubkey: bobPubKey,
  detail: 0
github barryWhiteHat / maci / app / utils / generate_circuit_input.js View on Github external
// @flow

const provingKey = require('../circuits/proving_key.json')
const verificationKey = require('../circuits/verification_key.json')
const circuitDef = require('../circuits/circuit.json')
const { eddsa, mimc7 } = require('circomlib')
const { Circuit } = require('snarkjs')
const zkSnark = require('snarkjs').original
const { unstringifyBigInts } = require('snarkjs/src/stringifybigint')

const alicePrvKey = Buffer.from('1'.toString().padStart(64, '0'), 'hex')
const alicePubKey = eddsa.prv2pub(alicePrvKey)
const bobPrvKey = Buffer.from('2'.toString().padStart(64, '0'), 'hex')
const bobPubKey = eddsa.prv2pub(bobPrvKey)

// accounts (1 = Yes, 0 = No)
const Alice = {
  pubkey: alicePubKey,
  detail: 1
}

const aliceHash = mimc7.multiHash(
  [Alice.pubkey[0], Alice.pubkey[1], BigInt(Alice.detail)]
)

const Bob = {
  pubkey: bobPubKey,
  detail: 0
}
const bobHash = mimc7.multiHash(
github iden3 / iden3js / src / crypto / eddsa-babyjub.js View on Github external
public(): PublicKey {
    return new PublicKey(eddsa.prv2pub(this.sk));
  }