@@ -57,48 +57,57 @@ template CheckByteRangeTransition() {
5757 out <== MultiAND(4 )([isCurrentState, isNextState, isByteValid[0 ], isByteValid[1 ]]);
5858}
5959
60- template CheckByteTransitionWithCapture () {
60+ template CheckByteTransitionWithCapture (numCaptureGroups ) {
6161 signal input currState;
6262 signal input nextState;
6363 signal input byte ;
64- signal input captureGroupId;
65- signal input captureGroupStart;
64+ signal input captureGroupId[numCaptureGroups] ;
65+ signal input captureGroupStart[numCaptureGroups] ;
6666
6767 signal input inCurrState;
6868 signal input inNextState;
6969 signal input inByte;
70- signal input inCaptureGroupId;
71- signal input inCaptureGroupStart;
70+ signal input inCaptureGroupId[numCaptureGroups] ;
71+ signal input inCaptureGroupStart[numCaptureGroups] ;
7272 signal output out;
7373
74- signal isCaptureGroupEqual <== IsEqual()([captureGroupId, inCaptureGroupId]);
75- signal isCaptureGroupStartEqual <== IsEqual()([captureGroupStart, inCaptureGroupStart]);
74+ component isCaptureGroupEqual = MultiAND(numCaptureGroups);
75+ component isCaptureGroupStartEqual = MultiAND(numCaptureGroups);
76+
77+ for (var i = 0 ; i < numCaptureGroups; i++ ) {
78+ isCaptureGroupEqual.in [i] <== IsEqual()([captureGroupId[i], inCaptureGroupId[i]]);
79+ isCaptureGroupStartEqual.in [i] <== IsEqual()([captureGroupStart[i], inCaptureGroupStart[i]]);
80+ }
7681 signal isValidTransition <== CheckByteTransition()(currState, nextState, byte , inCurrState, inNextState, inByte);
7782
78- out <== MultiAND(3 )([isValidTransition, isCaptureGroupEqual, isCaptureGroupStartEqual]);
83+ out <== MultiAND(3 )([isValidTransition, isCaptureGroupEqual.out , isCaptureGroupStartEqual.out ]);
7984}
8085
81- template CheckByteRangeTransitionWithCapture () {
86+ template CheckByteRangeTransitionWithCapture (numCaptureGroups ) {
8287 signal input currState;
8388 signal input nextState;
8489 signal input byteStart;
8590 signal input byteEnd;
86- signal input captureGroupId;
87- signal input captureGroupStart;
91+ signal input captureGroupId[numCaptureGroups] ;
92+ signal input captureGroupStart[numCaptureGroups] ;
8893
8994 signal input inCurrState;
9095 signal input inNextState;
9196 signal input inByte;
92- signal input inCaptureGroupId;
93- signal input inCaptureGroupStart;
97+ signal input inCaptureGroupId[numCaptureGroups] ;
98+ signal input inCaptureGroupStart[numCaptureGroups] ;
9499
95100 signal output out;
96101
97- signal isCaptureGroupEqual <== IsEqual()([captureGroupId, inCaptureGroupId]);
98- signal isCaptureGroupStartEqual <== IsEqual()([captureGroupStart, inCaptureGroupStart]);
102+ component isCaptureGroupEqual = MultiAND(numCaptureGroups);
103+ component isCaptureGroupStartEqual = MultiAND(numCaptureGroups);
104+ for (var i = 0 ; i < numCaptureGroups; i++ ) {
105+ isCaptureGroupEqual.in [i] <== IsEqual()([captureGroupId[i], inCaptureGroupId[i]]);
106+ isCaptureGroupStartEqual.in [i] <== IsEqual()([captureGroupStart[i], inCaptureGroupStart[i]]);
107+ }
99108 signal isValidTransition <== CheckByteRangeTransition()(currState, nextState, byteStart, byteEnd, inCurrState, inNextState, inByte);
100109
101- out <== MultiAND(3 )([isValidTransition, isCaptureGroupEqual, isCaptureGroupStartEqual]);
110+ out <== MultiAND(3 )([isValidTransition, isCaptureGroupEqual.out , isCaptureGroupStartEqual.out ]);
102111}
103112
104113template CaptureSubstring (maxBytes, maxSubstringBytes, captureId ) {
0 commit comments