In the sha256.circom, I have illustrated a complex hash circuit using circom. With the help of circom and snarkjs we can proof zksnarks.
npm install
message --> Private input
hash --> Public input
- Move to dir. sha256
cd circuits/sha256
- Give permission to all the script file
chmod +x *.sh
- Build the circuit with the help of circom
./build_circuit.sh -c sha256
- Create setup phase using the help of power of tau and snarkjs
./setup.sh -c sha256
- Generate Input file for the given message
node generate_input.js
- Generate witness
./generate_witness.sh -c sha256 -i input
- Create Proof
./create_proof.sh -i input
- Verify Proof
./verify_proof.sh
If the final output is [INFO] snarkJS: OK!
then user knowns the solution of the above hash function.