added addresses

This commit is contained in:
Divide-By-0
2022-10-13 03:13:16 -05:00
parent 0b9e9e65dc
commit 80077db9d8
2 changed files with 9 additions and 3 deletions

View File

@@ -24,6 +24,9 @@ template EmailVerify(max_header_bytes, max_body_bytes, n, k) {
signal reveal[max_header_bytes]; // bytes to reveal
signal output reveal_packed[max_packed_bytes]; // packed into 7-bytes. TODO: make this rotate to take up even less space
signal input address;
signal input address_plus_one;
signal input body_hash_idx;
signal body_hash[LEN_SHA_B64][max_header_bytes];
@@ -141,4 +144,4 @@ template EmailVerify(max_header_bytes, max_body_bytes, n, k) {
// In circom, all output signals of the main component are public (and cannot be made private), the input signals of the main component are private if not stated otherwise using the keyword public as above. The rest of signals are all private and cannot be made public.
// This makes modulus and reveal_packed public. Signature can optionally be made public, but is not recommended since it allows the mailserver to trace who the offender is.
component main { public [ modulus ] } = EmailVerify(1024, 4096, 121, 17);
component main { public [ modulus, address ] } = EmailVerify(1024, 4096, 121, 17);

View File

@@ -31,6 +31,8 @@ interface ICircuitInputs {
body_hash_idx?: string;
addressParts?: string[];
remainder_text_body?: string[];
address?: string;
address_plus_one?: string;
}
enum CircuitType {
@@ -181,7 +183,7 @@ export async function getCircuitInputs(
const remainder_text_body = await Uint8ArrayToCharArray(bodyPadded.slice(shaCutoffIndex)); // This is the remaining part of the sha that actually gets hashed
const address = bytesToBigInt(fromHex(eth_address));
const addressParts = toCircomBigIntBytes(address);
const addressPlusOne = bytesToBigInt(fromHex(eth_address)) + 1n;
if (circuit === CircuitType.RSA) {
circuitInputs = {
@@ -200,7 +202,8 @@ export async function getCircuitInputs(
precomputed_sha,
remainder_text_body,
body_hash_idx,
addressParts
address,
addressPlusOne
};
} else if (circuit === CircuitType.SHA) {
circuitInputs = {