Skip to content

Instantly share code, notes, and snippets.

@vio1etus
Last active June 5, 2023 04:48
Show Gist options
  • Save vio1etus/9d29ad1f85cb9dafcc135f21d9826e09 to your computer and use it in GitHub Desktop.
Save vio1etus/9d29ad1f85cb9dafcc135f21d9826e09 to your computer and use it in GitHub Desktop.
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";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment