Open this in zkREPL →
This file can be included into other zkREPLs with include "gist:9d29ad1f85cb9dafcc135f21d9826e09";
| pragma circom 2.1.4; | |
| include "circomlib/poseidon.circom"; | |
| template Secret2Public () { | |
| signal input sk; | |
| signal output pk; | |
| component poseidon = Poseidon(1); // the input of poseidon hash is the number of variables you want to hash, normally one or two | |
| poseidon.inputs[0] <== sk; | |
| pk <== poseidon.out; | |
| log("pk:", pk); | |
| } | |
| template Sign(){ | |
| signal input m; | |
| signal input sk; // private | |
| signal output pk; | |
| component checker = Secret2Public(); | |
| checker.sk <== sk; | |
| pk <== checker.pk; | |
| } | |
| component main = Sign(); | |
| /* INPUT = { | |
| "sk": "5", | |
| "m": "1" | |
| } */ |
Open this in zkREPL →
This file can be included into other zkREPLs with include "gist:9d29ad1f85cb9dafcc135f21d9826e09";