How to use the mcl-wasm.Fp2 function in mcl-wasm

To help you get started, we’ve selected a few mcl-wasm 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 ChainSafe / lodestar / old / index.js View on Github external
assert.equal(domain.length, 8, 'domain must be 8 bytes long')
	const xReal = keccak256(Buffer.concat([
    messageHash,
    domain,
    Buffer.from([1]),
  ]))
  const xRealFp = new mcl.Fp()
  xRealFp.setLittleEndian(xReal)
	const xImag = keccak256(Buffer.concat([
    messageHash,
    domain,
    Buffer.from([2]),
  ]))
  const xImagFp = new mcl.Fp()
  xImagFp.setLittleEndian(xImag)
  const xCoordinate = new mcl.Fp2()
  xCoordinate.set_a(xRealFp)
  xCoordinate.set_b(xImagFp)
  return xCoordinate.mapToG2()
}

mcl-wasm

mcl ; A portable and fast pairing-based cryptography library for Node.js by WebAssembly

BSD-3-Clause
Latest version published 8 months ago

Package Health Score

63 / 100
Full package analysis