diff --git a/packages/circuits/email-verifier.circom b/packages/circuits/email-verifier.circom index 78ac7706..f6388434 100644 --- a/packages/circuits/email-verifier.circom +++ b/packages/circuits/email-verifier.circom @@ -45,8 +45,8 @@ template EmailVerifier(maxHeadersLength, maxBodyLength, n, k, ignoreBodyHashChec // Assert `emailHeaderLength` fits in `ceil(log2(maxHeadersLength))` - component n2b = Num2Bits(log2Ceil(maxHeadersLength)); - n2b.in <== emailHeaderLength; + component n2bHeaderLength = Num2Bits(log2Ceil(maxHeadersLength)); + n2bHeaderLength.in <== emailHeaderLength; // Assert `emailHeader` data after `emailHeaderLength` are zeros @@ -91,8 +91,8 @@ template EmailVerifier(maxHeadersLength, maxBodyLength, n, k, ignoreBodyHashChec // Assert `emailBodyLength` fits in `ceil(log2(maxBodyLength))` - component n2b = Num2Bits(log2Ceil(maxBodyLength)); - n2b.in <== emailBodyLength; + component n2bBodyLength = Num2Bits(log2Ceil(maxBodyLength)); + n2bBodyLength.in <== emailBodyLength; // Assert data after the body (`maxBodyLength - emailBody.length`) is all zeroes diff --git a/packages/circuits/lib/rsa.circom b/packages/circuits/lib/rsa.circom index ae5e86ca..f82e487b 100644 --- a/packages/circuits/lib/rsa.circom +++ b/packages/circuits/lib/rsa.circom @@ -7,9 +7,9 @@ include "./fp.circom"; /// @notice Verifies an RSA signature with exponent 65537. /// @param n Number of bits per chunk the modulus is split into. Recommended to be 121. /// @param k Number of chunks the modulus is split into. Recommended to be 17. -/// @input message[k] The message that was signed; assumes to consist of `k` chunks that fit in `n` bits (also contrained implicitly). -/// @input signature[k] The signature to verify; assumes to consist of `k` chunks that fit in `n` bits (also contrained implicitly). -/// @input modulus[k] The modulus of the RSA key (pubkey); assumes to consist of `k` chunks that fit in `n` bits (also contrained implicitly). +/// @input message[k] The message that was signed; assumes to consist of `k` chunks that fit in `n` bits (also constrained implicitly). +/// @input signature[k] The signature to verify; assumes to consist of `k` chunks that fit in `n` bits (also constrained implicitly). +/// @input modulus[k] The modulus of the RSA key (pubkey); assumes to consist of `k` chunks that fit in `n` bits (also constrained implicitly). template RSAVerifier65537(n, k) { signal input message[k]; signal input signature[k]; diff --git a/packages/circuits/utils/array.circom b/packages/circuits/utils/array.circom index 985fce70..d743aaa9 100644 --- a/packages/circuits/utils/array.circom +++ b/packages/circuits/utils/array.circom @@ -19,9 +19,9 @@ template ItemAtIndex(maxArrayLen) { signal output out; - component calcTotal = CalculateTotal(maxArrayLen); - component eqs[maxArrayLen]; + component calcTotalValue = CalculateTotal(maxArrayLen); component calcTotalIndex = CalculateTotal(maxArrayLen); + component eqs[maxArrayLen]; // For each item, check whether its index equals the input index. for (var i = 0; i < maxArrayLen; i ++) { @@ -30,7 +30,7 @@ template ItemAtIndex(maxArrayLen) { eqs[i].in[1] <== index; // eqs[i].out is 1 if the index matches - so calcTotal is sum of 0s + 1 * valueAtIndex - calcTotal.nums[i] <== eqs[i].out * in[i]; + calcTotalValue.nums[i] <== eqs[i].out * in[i]; // Take the sum of all eqs[i].out and assert that it is at most 1. calcTotalIndex.nums[i] <== eqs[i].out; @@ -39,7 +39,7 @@ template ItemAtIndex(maxArrayLen) { // Assert that the sum of eqs[i].out is 1. This is to ensure the index passed is valid. calcTotalIndex.sum === 1; - out <== calcTotal.sum; + out <== calcTotalValue.sum; } diff --git a/packages/circuits/utils/bytes.circom b/packages/circuits/utils/bytes.circom index a5ccd13a..2091d076 100644 --- a/packages/circuits/utils/bytes.circom +++ b/packages/circuits/utils/bytes.circom @@ -105,8 +105,6 @@ template DigitBytesToInt(n) { signal sums[n+1]; sums[0] <== 0; - // TODO: Should we constrain the input ASCII to be between 48 and 57? - for(var i = 0; i < n; i++) { sums[i + 1] <== 10 * sums[i] + (in[i] - 48); }