Files
zk-nullifier-sig/javascript/test/hashToCurve.test.ts
Anton 79c602670b chore: clean up (#74)
* chore: clean up

- [x] Add checks for ci actions
- [x] Run prettier, clippy, fmt commands for all the files
- [x] Move circom circuits to a circom folder
- [x] Get rid of js var statements

* chore: add resolver version for cargo.toml

* chore: add circom tests

* chore: optimize check triggers

* chore: remove `check` command

* chore: use only `pnpm`

* chore: update readme

---------

Co-authored-by: 0xmad <0xmad@users.noreply.github.com>
2023-11-18 20:48:24 +03:00

22 lines
777 B
TypeScript

import hashToCurve from "../src/utils/hashToCurve";
describe("hashToCurve", () => {
it("successfully hashes correct values", () => {
const testPreimage = [
65, 110, 32, 101, 120, 97, 109, 112, 108, 101, 32, 97, 112, 112, 32, 109,
101, 115, 115, 97, 103, 101, 32, 115, 116, 114, 105, 110, 103, 3, 12, 236,
2, 142, 224, 141, 9, 224, 38, 114, 166, 131, 16, 129, 67, 84, 249, 234,
191, 255, 13, 230, 218, 204, 28, 211, 167, 116, 73, 96, 118, 174,
];
const hash = hashToCurve(testPreimage);
expect(hash.x.toString()).toEqual(
"bcac2d0e12679f23c218889395abcdc01f2affbc49c54d1136a2190db0800b65",
);
expect(hash.y.toString()).toEqual(
"3bcfb339c974c0e757d348081f90a123b0a91a53e32b3752145d87f0cd70966e",
);
});
});