Skip to content

Commit

Permalink
circuit: rename bodyHash variable
Browse files Browse the repository at this point in the history
  • Loading branch information
saleel committed Mar 30, 2024
1 parent c1c18b8 commit 85f95a6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/circuits/email-verifier.circom
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,16 @@ template EmailVerifier(maxHeaderLength, maxBodyLength, n, k, ignoreBodyHashCheck
// Compute SHA256 of email body : 760,142 constraints
// We are using a technique to save constraints by precomputing the SHA hash of the body till the area we want to extract
// It doesn't have an impact on security since a user must have known the pre-image of a signed message to be able to fake it
signal calculatedBodyHash[256] <== Sha256BytesPartial(maxBodyLength)(emailBody, emailBodyLength, precomputedSHA);
signal computedBodyHash[256] <== Sha256BytesPartial(maxBodyLength)(emailBody, emailBodyLength, precomputedSHA);

// Ensure the bodyHash from the header matches the calculated body hash
component calculatedBodyHashNum[32];
component computedBodyHashInts[32];
for (var i = 0; i < 32; i++) {
calculatedBodyHashNum[i] = Bits2Num(8);
computedBodyHashInts[i] = Bits2Num(8);
for (var j = 0; j < 8; j++) {
calculatedBodyHashNum[i].in[7 - j] <== calculatedBodyHash[i * 8 + j];
computedBodyHashInts[i].in[7 - j] <== computedBodyHash[i * 8 + j];
}
calculatedBodyHashNum[i].out === headerBodyHash[i];
computedBodyHashInts[i].out === headerBodyHash[i];
}
}

Expand Down

0 comments on commit 85f95a6

Please sign in to comment.