Closed adrianmcli closed 5 months ago
@NOOMA-42 has stated he will fill in the Practical (Circom) section of this Module. I will review and make my edits afterwards.
The answer for writing a circuit to check output of hash:
pragma circom 2.1.6;
include "circomlib/poseidon.circom";
template HashProof() {
signal input preimage;
signal input hash;
signal output hashOutput;
component hasher = Poseidon(1);
hasher.inputs[0] <== preimage;
hashOutput <== hasher.out;
// Enforce that the hash matches the given hash
hash === hashOutput;
}
component main = HashProof();
/* INPUT = {
"preimage": "12345",
"hash": "4267533774488295900887461483015112262021273608761099826938271132511348470966"
} */
Instead of showing the above, we should break it down so that we force the student to come up with the above. We can give it to them in parts. Please see the latest commit for an example.
@NOOMA-42 do you think it is sufficiently simple and black-boxed?
I will just merge it now, we can always improve this later.
1️⃣ Week 1 - Cryptographic Basics
Practical
Study