zkhash/poseidon2/
poseidon2_instance_vesta.rs

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
use super::poseidon2_params::Poseidon2Params;
use crate::fields::vesta::FpVesta;
use crate::fields::utils::from_hex;

use lazy_static::lazy_static;
use std::sync::Arc;

type Scalar = FpVesta;

lazy_static! {
    pub static ref MAT_DIAG3_M_1: Vec<Scalar> = vec![
        from_hex("0x0000000000000000000000000000000000000000000000000000000000000001"),
        from_hex("0x0000000000000000000000000000000000000000000000000000000000000001"),
        from_hex("0x0000000000000000000000000000000000000000000000000000000000000002"),
    ];

    pub static ref MAT_INTERNAL3: Vec<Vec<Scalar>> = vec![
        vec![from_hex("0x0000000000000000000000000000000000000000000000000000000000000002"),
        from_hex("0x0000000000000000000000000000000000000000000000000000000000000001"),
        from_hex("0x0000000000000000000000000000000000000000000000000000000000000001"),
        ],
        vec![from_hex("0x0000000000000000000000000000000000000000000000000000000000000001"),
        from_hex("0x0000000000000000000000000000000000000000000000000000000000000002"),
        from_hex("0x0000000000000000000000000000000000000000000000000000000000000001"),
        ],
        vec![from_hex("0x0000000000000000000000000000000000000000000000000000000000000001"),
        from_hex("0x0000000000000000000000000000000000000000000000000000000000000001"),
        from_hex("0x0000000000000000000000000000000000000000000000000000000000000003"),
        ],
    ];
    
    pub static ref RC3: Vec<Vec<Scalar>> = vec![
    vec![from_hex("0x360d7470611e473d353f628f76d110f34e71162f31003b7057538c2596426303"),
    from_hex("0x2bab94d7ae222d135dc3c6c5febfaa314908ac2f12ebe06fbdb74213bf63188b"),
    from_hex("0x150c93fef652fb1c2bf03e1a29aa871fef77e7d736766c5d0939d92753cc5dc8"),
    ],
    vec![from_hex("0x3270661e68928b3a955d55db56dc57c103cc0a60141e894e14259dce537782b2"),
    from_hex("0x073f116f04122e25a0b7afe4e2057299b407c370f2b5a1ccce9fb9ffc345afb3"),
    from_hex("0x2a32ec5c4ee5b1837affd09c1f53f5fd55c9cd2061ae93ca8ebad76fc71554d8"),
    ],
    vec![from_hex("0x270326ee039df19e651e2cfc740628ca634d24fc6e2559f22d8ccbe292efeead"),
    from_hex("0x27c6642ac633bc66dc100fe7fcfa54918af895bce012f182a068fc37c182e274"),
    from_hex("0x1bdfd8b01401c70ad27f57396989129d710e1fb6ab976a459ca18682e26d7ff9"),
    ],
    vec![from_hex("0x162a14c62f9a89b814b9d6a9c84dd678f4f6fb3f9054d373c832d824261a35ea"),
    from_hex("0x2d193e0f76de586b2af6f79e3127feeaac0a1fc71e2cf0c0f79824667b5b6bec"),
    from_hex("0x044ca3cc4a85d73b81696ef1104e674f4feff82984990ff85d0bf58dc8a4aa94"),
    ],
    vec![from_hex("0x1cbaf2b371dac6a81d0453416d3e235cb8d9e2d4f314f46f6198785f0cd6b9af"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x1d5b2777692c205b0e6c49d061b6b5f4293c4ab038fdbbdc343e07610f3fede5"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x2e9bdbba3dd34bffaa30535bdd749a7e06a9adb0c1e6f962f60e971b8d73b04f"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x2de11886b18011ca8bd5bae36969299fde40fbe26d047b05035a13661f22418b"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x2e07de1780b8a70d0d5b4a3f1841dcd82ab9395c449be947bc998884ba96a721"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x0f69f1854d20ca0cbbdb63dbd52dad16250440a99d6b8af3825e4c2bb74925ca"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x2eb1b25417fe17670d135dc639fb09a46ce5113507f96de9816c059422dc705e"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x115cd0a0643cfb988c24cb44c3fab48aff36c661d26cc42db8b1bdf4953bd82c"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x26ca293f7b2c462d066d7378b999868bbb57ddf14e0f958ade801612311d04cd"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x17bf1b93c4c7e01a2a830aa162412cd90f160bf9f71e967ff5209d14b24820ca"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x35b41a7ac4f3c571a24f8456369c85dfe03c0354bd8cfd3805c86f2e7dc293c5"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x3b1480080523c439435927994849bea964e14d3beb2dddde72ac156af435d09e"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x2cc6810031dc1b0d4950856dc907d57508e286442a2d3eb2271618d874b14c6d"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x25bdbbeda1bde8c1059618e2afd2ef999e517aa93b78341d91f318c09f0cb566"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x392a4a8758e06ee8b95f33c25dde8ac02a5ed0a27b61926cc6313487073f7f7b"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x272a55878a08442b9aa6111f4de009485e6a6fd15db89365e7bbcef02eb5866c"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x2d5b308b0cf02cdfefa13c4e60e26239a6ebba011694dd129b925b3c5b21e0e2"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x16549fc6af2f3b72dd5d293d72e2e5f244dff42f18b46c56ef38c57c311673ac"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x1b10bb7a82afce39fa69c3a2ad52f76d76398265344203119b7126d9b46860df"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x0f1e7505ebd91d2fc79c2df7dc98a3bed1b36968ba0405c090d27f6a00b7dfc8"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x2f313faf0d3f6187537a7497a3b43f46797fd6e3f18eb1caff457756b819bb20"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x3a5cbb6de450b481fa3ca61c0ed15bc55cad11ebf0f7ceb8f0bc3e732ecb26f6"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x3dab54bc9bef688dd92086e253b439d651baa6e20f892b62865527cbca915982"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x06dbfb42b979884de280d31670123f744c24b33b410fefd4368045acf2b71ae3"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x068d6b4608aae810c6f039ea1973a63eb8d2de72e3d2c9eca7fc32d22f18b9d3"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x366ebfafa3ad381c0ee258c9b8fdfccdb868a7d7e1f1f69a2b5dfcc5572555df"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x39678f65512f1ee404db3024f41d3f567ef66d89d044d022e6bc229e95bc76b1"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x21668f016a8063c0d58b7750a3bc2fe1cf82c25f99dc01a4e534c88fe53d85fe"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x39d00994a8a5046a1bc749363e98a768e34dea56439fe1954bef429bc5331608"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x1f9dbdc3f84312636b203bbe12fb3425b163d41605d39f99770c956f60d881b3"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x027745a9cddfad95e5f17b9e0ee0cab6be0bc829fe5e66c69794a9f7c336eab2"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x1cec0803c504b635788d695c61e932122fa43fe20a45c78d52025657abd8aee0"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x123523d75e9fabc172077448ef87cc6eed5082c8dbf31365d3872a9559a03a73"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x1723d1452c9cf02df419b848e5d694bf27feba35975ee7e5001779e3a1d357f4"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x1739d180a16010bdfcc0573d7e61369421c3f776f572836d9dab1ee4dcf96622"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x2d4e6354da9cc554acce32391794b627fafa96fbeb0ab89370290452042d048d"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x153ee6142e535e334a869553c9d007f88f3bd43f99260621670bcf6f8b485dcd"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x0c45bfd3a69aaa65635ef7e7a430b486968ad4424af83700d258d2e2b7782172"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x0adfd53b256a6957f2d56aec831446006897ac0a8ffa5ff10e5633d251f73307"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x315d2ac8ebdbac3c8cd1726b7cbab8ee3f87b28f1c1be4bdac9d36a8b7516d63"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x1b8472712d02eef4cfaec23d2b16883fc9bb60d1f6959879299ce44ea423d8e1"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x3c1cd07efda6ff24bd0b70fa2255eb6f367d2c54e36928c9c4a5404198adf70c"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x136052d26bb3d373687f4e51b2e1dcd34a16073f738f7e0cbbe523aef9ab107a"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x16c96beef6a0a848c1bdd859a1232a1d7b3cfbb873032681676c36c24ef967dd"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x284b38c57ff65c262ab7fed8f499a9fb012387bab4f1662d067eec7f2d6340c4"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x0c5993d175e81f6639e242198897d17cfc06772c1c0411a6af1dff204c922f86"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x03bf7a3f7bd043dafcda655d1ba9c8f9f24887ad48e17759bbf53f67b1f87b15"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x3188fe4ee9f9fafbb0cf999567f00e734c8f9cbe69f0e8279b5cd09e36d8be62"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x171f528ccf6584375a39768c480d61e13af5bf77c1c42652afea99a2ec6c595a"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x12f4175c4ab45afc196e41859b35ef88812c3286ee7000675a0563b9b8e9f1d5"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x3a509e155cb7ebfd8f8fdcf800a9ac697e23e1aabe96cfab0e74d4d369118b79"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x10f2a685df4a27c81a89920e2504c3b3984bc8f2e4c1b69e98712c65678cfd30"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x09e5f49790c8a0e21d8d93d54ab91a0e54573c9333c56321e8a16728cc9d4918"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x352d69bed80ee3e52bf35705d9f84a3442d17ed6ee0fab7e609a740347cf5fea"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x058ee73ba9f3f293491562faf2b190d3c634debd281b76a63a758af6fa84e0e8"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x232f99cc911eddd9cd0f1fc55b1a3250092cb92119bc76be621a132510a43904"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    from_hex("0x0000000000000000000000000000000000000000000000000000000000000000"),
    ],
    vec![from_hex("0x201beed7b8f3ab8186c22c6c5d4869f0f9efd52ca6bc2961c3b97c1e301bc213"),
    from_hex("0x1376dce6580030c6a1c9291d58602f5129388842744a1210bf6b3431ba94e9bc"),
    from_hex("0x1793199e6fd6ba342b3356c38238f761072ba8b02d92e7226454843c5486d7b3"),
    ],
    vec![from_hex("0x22de7a7488dcc7359fee9c20c87a67df3c66160dc62aacac06a3f1d3b433311b"),
    from_hex("0x3514d5e9066bb160df8ff37fe2d8edf8dbe0b77fae77e1d030d6e3fd516b47a8"),
    from_hex("0x30cd3006931ad636f919a00dabbf5fa5ff453d6f900f144a19377427137a81c7"),
    ],
    vec![from_hex("0x253d1a5c5293412741f81a5cf613c8df8f9e4b2cae2ebb515b6a74220692b506"),
    from_hex("0x035b461c02d79d19a35e9613e7f5fe92851b3a59c990fafc73f666cb86a48e8e"),
    from_hex("0x23a9928079d175bd5bc00eedd56b93e092b1283c2d5fccde7cfbf86a3aa04780"),
    ],
    vec![from_hex("0x13a7785ae134ea92f1594a0763c611abb5e2ea3436eef957f1e4ccd73fa00a82"),
    from_hex("0x39fce308b7d43c574962ae3c0da17e313889c57863446d88bbf04f5252de4279"),
    from_hex("0x1aae18833f8e1d3ac0fdf01662f60d22bef00a08c6ed38d23b57e34489b53fad"),
    ],
    ];
    
    pub static ref POSEIDON2_VESTA_PARAMS: Arc<Poseidon2Params<Scalar>> = Arc::new(Poseidon2Params::new(3, 5, 8, 56, &MAT_DIAG3_M_1, &MAT_INTERNAL3, &RC3));
}