You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

30 lines
672 B

pragma circom 2.0.0;
include "../node_modules/circomlib/circuits/poseidon.circom";
template Hasher(inputSize) {
signal input values[inputSize];
signal output hash;
component hasher = Poseidon(inputSize);
for (var i = 0; i < inputSize; i++) {
hasher.inputs[i] <== values[i];
}
hash <== hasher.out;
}
template RowHasher (width) {
signal input img[width];
signal output hash;
component hasher[width-1];
for(var i=0; i < width-1; i++) {
hasher[i] = Hasher(2);
hasher[i].values[0] <== i == 0 ? img[0] : hasher[i-1].hash;
hasher[i].values[1] <== img[i+1];
}
hash <== hasher[width-2].hash;
}