-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathResults_circom.txt
executable file
·358 lines (221 loc) · 9.65 KB
/
Results_circom.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
Fibonacci
template Fibonacci(n) {
assert(n >= 2);
signal input in[2];
signal output out;
signal fib[n+1];
fib[0] <== in[0];
fib[1] <== in[1];
for (var i = 2; i <= n; i++) {
fib[i] <== fib[i-2] + fib[i-1];
}
out <== fib[n];
}
Results:
10
[fibonacci_10] Compile Circuit: 0.58 seconds 44480.0 KB
[fibonacci_10] Constraints: 9
command_output:
2.42 186728
[fibonacci_10] Setup Prover: 2.42 seconds 186728.0 KB
command_output:
0.87 167200
[fibonacci_10] Prover: 0.87 seconds 167200.0 KB
command_output:
0.77 153984
[fibonacci_10] Verifier: 0.77 seconds 153984.0 KB
measures: {'CIRCUIT': 'fibonacci_10', 'INPUT SIZE': 'fibonacci', 'CONSTRAINTS': 9, 'COMPILE_TIME': 0.58, 'COMPILE_MEMORY': 44480.0, 'SETUP_TIME': 2.42, 'SETUP_MEMORY': 186728.0, 'PROVER_TIME': 0.87, 'PROVER_MEMORY': 167200.0, 'VERIFIER_TIME': 0.77, 'VERIFIER_MEMORY': 153984.0}
100
[fibonacci_100] Compile Circuit: 0.31 seconds 45972.0 KB
[fibonacci_100] Constraints: 99
command_output:
1.76 205504
[fibonacci_100] Setup Prover: 1.76 seconds 205844.0 KB
command_output:
0.76 184692
[fibonacci_100] Prover: 0.76 seconds 184692.0 KB
command_output:
0.69 177296
[fibonacci_100] Verifier: 0.69 seconds 177296.0 KB
measures: {'CIRCUIT': 'fibonacci_100', 'INPUT SIZE': 'fibonacci', 'CONSTRAINTS': 99, 'COMPILE_TIME': 0.31, 'COMPILE_MEMORY': 45972.0, 'SETUP_TIME': 1.76, 'SETUP_MEMORY': 205844.0, 'PROVER_TIME': 0.76, 'PROVER_MEMORY': 184692.0, 'VERIFIER_TIME': 0.69, 'VERIFIER_MEMORY': 177296.0}
1000
[fibonacci_1000] Compile Circuit: 0.3 seconds 56608.0 KB
[fibonacci_1000] Constraints: 999
command_output:
2.07 217224
[fibonacci_1000] Setup Prover: 2.07 seconds 217492.0 KB
command_output:
0.87 229944
[fibonacci_1000] Prover: 0.87 seconds 229944.0 KB
command_output:
0.68 175916
[fibonacci_1000] Verifier: 0.68 seconds 175916.0 KB
measures: {'CIRCUIT': 'fibonacci_1000', 'INPUT SIZE': 'fibonacci', 'CONSTRAINTS': 999, 'COMPILE_TIME': 0.3, 'COMPILE_MEMORY': 56608.0, 'SETUP_TIME': 2.07, 'SETUP_MEMORY': 217492.0, 'PROVER_TIME': 0.87, 'PROVER_MEMORY': 229944.0, 'VERIFIER_TIME': 0.68, 'VERIFIER_MEMORY': 175916.0}
10000
[fibonacci_10000] Compile Circuit: 0.7 seconds 59156.0 KB
[fibonacci_10000] Constraints: 9999
command_output:
7.42 312036
[fibonacci_10000] Setup Prover: 7.42 seconds 312348.0 KB
command_output:
1.75 466280
[fibonacci_10000] Prover: 1.75 seconds 466280.0 KB
command_output:
0.81 177012
[fibonacci_10000] Verifier: 0.81 seconds 177012.0 KB
measures: {'CIRCUIT': 'fibonacci_10000', 'INPUT SIZE': 'fibonacci', 'CONSTRAINTS': 9999, 'COMPILE_TIME': 0.7, 'COMPILE_MEMORY': 59156.0, 'SETUP_TIME': 7.42, 'SETUP_MEMORY': 312348.0, 'PROVER_TIME': 1.75, 'PROVER_MEMORY': 466280.0, 'VERIFIER_TIME': 0.81, 'VERIFIER_MEMORY': 177012.0}
100000
[fibonacci_100000] Compile Circuit: 4.26 seconds 305812.0 KB
[fibonacci_100000] Constraints: 99999
command_output:
18.94 779472
[fibonacci_100000] Setup Prover: 18.94 seconds 780320.0 KB
command_output:
4.81 1067972
[fibonacci_100000] Prover: 4.81 seconds 1070296.0 KB
command_output:
0.74 175532
[fibonacci_100000] Verifier: 0.74 seconds 175532.0 KB
measures: {'CIRCUIT': 'fibonacci_100000', 'INPUT SIZE': 'fibonacci', 'CONSTRAINTS': 99999, 'COMPILE_TIME': 4.26, 'COMPILE_MEMORY': 305812.0, 'SETUP_TIME': 18.94, 'SETUP_MEMORY': 780320.0, 'PROVER_TIME': 4.81, 'PROVER_MEMORY': 1070296.0, 'VERIFIER_TIME': 0.74, 'VERIFIER_MEMORY': 175532.0}
SHA256:
template Sha256Bytes(n) {
signal input in[n];
signal output out[32];
component byte_to_bits[n];
for (var i = 0; i < n; i++) {
byte_to_bits[i] = Num2Bits(8);
byte_to_bits[i].in <== in[i];
}
component sha256 = Sha256(n*8);
for (var i = 0; i < n; i++) {
for (var j = 0; j < 8; j++) {
sha256.in[i*8+j] <== byte_to_bits[i].out[7-j];
}
}
component bits_to_bytes[32];
for (var i = 0; i < 32; i++) {
bits_to_bytes[i] = Bits2Num(8);
for (var j = 0; j < 8; j++) {
bits_to_bytes[i].in[7-j] <== sha256.out[i*8+j];
}
out[i] <== bits_to_bytes[i].out;
}
}
Results:
32B
[sha256_bytes_32] Compile Circuit: 4.29 seconds 262552.0 KB
[sha256_bytes_32] Constraints: 31584
command_output:
15.49 545868
[sha256_bytes_32] Setup Prover: 15.49 seconds 545868.0 KB
command_output:
2.43 564824
[sha256_bytes_32] Prover: 2.43 seconds 564824.0 KB
command_output:
0.80 176992
[sha256_bytes_32] Verifier: 0.8 seconds 176992.0 KB
measures: {'CIRCUIT': 'sha256_bytes_32', 'INPUT SIZE': '32', 'CONSTRAINTS': 31584, 'COMPILE_TIME': 4.29, 'COMPILE_MEMORY': 262552.0, 'SETUP_TIME': 15.49, 'SETUP_MEMORY': 545868.0, 'PROVER_TIME': 2.43, 'PROVER_MEMORY': 564824.0, 'VERIFIER_TIME': 0.8, 'VERIFIER_MEMORY': 176992.0}
100B
[sha256_bytes_100] Compile Circuit: 5.67 seconds 430488.0 KB
[sha256_bytes_100] Constraints: 63460
command_output:
27.31 836584
[sha256_bytes_100] Setup Prover: 27.31 seconds 836584.0 KB
command_output:
3.44 791336
[sha256_bytes_100] Prover: 3.44 seconds 791336.0 KB
command_output:
0.97 176512
[sha256_bytes_100] Verifier: 0.97 seconds 176512.0 KB
measures: {'CIRCUIT': 'sha256_bytes_100', 'INPUT SIZE': '100', 'CONSTRAINTS': 63460, 'COMPILE_TIME': 5.67, 'COMPILE_MEMORY': 430488.0, 'SETUP_TIME': 27.31, 'SETUP_MEMORY': 836584.0, 'PROVER_TIME': 3.44, 'PROVER_MEMORY': 791336.0, 'VERIFIER_TIME': 0.97, 'VERIFIER_MEMORY': 176512.0}
1024B
[sha256_bytes_1024] Compile Circuit: 55.86 seconds 3528280.0 KB
[sha256_bytes_1024] Constraints: 540736
command_output:
202.60 2880348
[sha256_bytes_1024] Setup Prover: 202.6 seconds 3267144.0 KB
command_output:
46.07 3104048
[sha256_bytes_1024] Prover: 46.07 seconds 3920848.0 KB
command_output:
1.14 183288
[sha256_bytes_1024] Verifier: 1.14 seconds 183288.0 KB
measures: {'CIRCUIT': 'sha256_bytes_1024', 'INPUT SIZE': '1024', 'CONSTRAINTS': 540736, 'COMPILE_TIME': 55.86, 'COMPILE_MEMORY': 3528280.0, 'SETUP_TIME': 202.6, 'SETUP_MEMORY': 3267144.0, 'PROVER_TIME': 46.07, 'PROVER_MEMORY': 3920848.0, 'VERIFIER_TIME': 1.14, 'VERIFIER_MEMORY': 183288.0}
Poseidon Hash:
pragma circom 2.0.0;
include "../../node_modules/circomlib/circuits/poseidon.circom";
template SpongeHash(inputs_length){
signal input in[inputs_length];
signal output hash;
var k = 0;
var hash_blocks = (inputs_length\15) + 1;
var block_index = 0;
component poseidon_hash[hash_blocks];
signal inside_hash[hash_blocks];
signal frame[hash_blocks][16];
for (var i=0; i<inputs_length; i++) {
frame[block_index][k] <== in[i];
if (k == 15){
//* START POSEIDON HASH
poseidon_hash[block_index] = Poseidon(16);
for (var j=0; j<16; j++)
poseidon_hash[block_index].inputs[j] <== frame[block_index][j];
inside_hash[block_index] <== poseidon_hash[block_index].out;
block_index++;
//*/ END POSEIDON HASH
frame[block_index][0] <== inside_hash[block_index - 1];
k = 1;
} else
k++;
}
if (inputs_length%16 != 0){
//* START POSEIDON HASH
poseidon_hash[block_index] = Poseidon(16);
for (var j=0; j<16; j++)
poseidon_hash[block_index].inputs[j] <== j<k ? frame[block_index][j] : 0;
hash <== poseidon_hash[block_index].out;
//*/ END POSEIDON HASH
}else
hash <== frame[block_index][0];
}
//MAIN component main = SpongeHash(NUM);
Results:
32B
[poseidon_sponge_32] Compile Circuit: 5.23 seconds 637012.0 KB
[poseidon_sponge_32] Constraints: 4184
command_output:
6.46 271296
[poseidon_sponge_32] Setup Prover: 6.46 seconds 271296.0 KB
command_output:
1.19 373560
[poseidon_sponge_32] Prover: 1.19 seconds 373560.0 KB
command_output:
0.72 178188
[poseidon_sponge_32] Verifier: 0.72 seconds 178188.0 KB
measures: {'CIRCUIT': 'poseidon_sponge_32', 'INPUT SIZE': '32', 'CONSTRAINTS': 4184, 'COMPILE_TIME': 5.23, 'COMPILE_MEMORY': 637012.0, 'SETUP_TIME': 6.46, 'SETUP_MEMORY': 271296.0, 'PROVER_TIME': 1.19, 'PROVER_MEMORY': 373560.0, 'VERIFIER_TIME': 0.72, 'VERIFIER_MEMORY': 178188.0}
100B
[poseidon_sponge_100] Compile Circuit: 7.98 seconds 636844.0 KB
[poseidon_sponge_100] Constraints: 14644
command_output:
11.19 353748
[poseidon_sponge_100] Setup Prover: 11.19 seconds 353748.0 KB
command_output:
1.77 477136
[poseidon_sponge_100] Prover: 1.77 seconds 477136.0 KB
command_output:
0.97 176236
[poseidon_sponge_100] Verifier: 0.97 seconds 176236.0 KB
measures: {'CIRCUIT': 'poseidon_sponge_100', 'INPUT SIZE': '100', 'CONSTRAINTS': 14644, 'COMPILE_TIME': 7.98, 'COMPILE_MEMORY': 636844.0, 'SETUP_TIME': 11.19, 'SETUP_MEMORY': 353748.0, 'PROVER_TIME': 1.77, 'PROVER_MEMORY': 477136.0, 'VERIFIER_TIME': 0.97, 'VERIFIER_MEMORY': 176236.0}
1024B
[poseidon_sponge_1024] Compile Circuit: 10.59 seconds 651656.0 KB
[poseidon_sponge_1024] Constraints: 142256
command_output:
50.75 1006772
[poseidon_sponge_1024] Setup Prover: 50.75 seconds 1007028.0 KB
command_output:
13.88 1349436
[poseidon_sponge_1024] Prover: 13.88 seconds 1361740.0 KB
command_output:
1.00 179976
[poseidon_sponge_1024] Verifier: 1.0 seconds 179976.0 KB
measures: {'CIRCUIT': 'poseidon_sponge_1024', 'INPUT SIZE': '1024', 'CONSTRAINTS': 142256, 'COMPILE_TIME': 10.59, 'COMPILE_MEMORY': 651656.0, 'SETUP_TIME': 50.75, 'SETUP_MEMORY': 1007028.0, 'PROVER_TIME': 13.88, 'PROVER_MEMORY': 1361740.0, 'VERIFIER_TIME': 1.0, 'VERIFIER_MEMORY': 179976.0}