You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
653 B

  1. const chai = require("chai");
  2. const path = require("path");
  3. const zkSnark = require("zksnark");
  4. const compiler = require("../index.js");
  5. const assert = chai.assert;
  6. describe("SHA256 test", () => {
  7. it("Should create a constant circuit", async () => {
  8. const cirDef = await compiler(path.join(__dirname, "circuits", "constants_test.jaz"));
  9. assert.equal(cirDef.nVars, 2);
  10. const circuit = new zkSnark.Circuit(cirDef);
  11. const witness = circuit.calculateWitness({ "in": "0xd807aa98" });
  12. assert(witness[0].equals(zkSnark.bigInt(1)));
  13. assert(witness[1].equals(zkSnark.bigInt("0xd807aa98")));
  14. });
  15. });