tornado-nova/circuits/keypair.circom

25 lines
632 B
Plaintext
Raw Normal View History

2021-06-06 19:31:32 +02:00
include "../node_modules/circomlib/circuits/poseidon.circom";
2020-04-08 11:41:12 +02:00
// Since we don't use signatures, the keypair can be based on a simple hash
2020-04-08 11:41:12 +02:00
template Keypair() {
signal input privateKey;
signal output publicKey;
2021-06-06 19:31:32 +02:00
component hasher = Poseidon(1);
hasher.inputs[0] <== privateKey;
publicKey <== hasher.out;
2021-10-30 21:35:35 +02:00
}
template Signature() {
signal input privateKey;
2021-11-08 16:05:57 +01:00
signal input commitment;
2021-10-30 21:35:35 +02:00
signal input merklePath;
signal output out;
2021-11-08 16:05:57 +01:00
component hasher = Poseidon(3);
2021-10-30 21:35:35 +02:00
hasher.inputs[0] <== privateKey;
2021-11-08 16:05:57 +01:00
hasher.inputs[1] <== commitment;
hasher.inputs[2] <== merklePath;
2021-10-30 21:35:35 +02:00
out <== hasher.out;
}