You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

856 lines
17 KiB

  1. package poseidon
  2. import "github.com/iden3/go-iden3-crypto/ffg"
  3. const (
  4. // NROUNDSF const from original paper
  5. NROUNDSF = 8
  6. // NROUNDSP const from original paper
  7. NROUNDSP = 22
  8. // CAPLEN const
  9. CAPLEN = 4
  10. // mLen const
  11. mLen = 12
  12. )
  13. var (
  14. mcirc = []uint64{17, 15, 41, 16, 2, 28, 13, 13, 39, 18, 34, 20}
  15. mdiag = []uint64{8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
  16. c = []uint64{
  17. 0xb585f766f2144405,
  18. 0x7746a55f43921ad7,
  19. 0xb2fb0d31cee799b4,
  20. 0xf6760a4803427d7,
  21. 0xe10d666650f4e012,
  22. 0x8cae14cb07d09bf1,
  23. 0xd438539c95f63e9f,
  24. 0xef781c7ce35b4c3d,
  25. 0xcdc4a239b0c44426,
  26. 0x277fa208bf337bff,
  27. 0xe17653a29da578a1,
  28. 0xc54302f225db2c76,
  29. 0xac6c9c2b4418dd61,
  30. 0xe0888eb1e8a01286,
  31. 0x813dbe952b98904e,
  32. 0xcc3033609c9cf175,
  33. 0x72cebc82a59c0f82,
  34. 0x8150d8525753e741,
  35. 0xb1122c74b268d66e,
  36. 0x7c6ddd482375aa2,
  37. 0xa4dd6f1ef49fb6af,
  38. 0xd33b0d5b4f7ccfe5,
  39. 0xc523112247209124,
  40. 0x464804200134c32d,
  41. 0xcd09dea180de4f2c,
  42. 0xadb069225c93e4e6,
  43. 0xbf01209b8a7c8534,
  44. 0xb1eb37d319913823,
  45. 0xdadf943b8d3e5a0d,
  46. 0x6d15f3cb7a3520ba,
  47. 0xf07af62b134ef181,
  48. 0x568355076c6b0de6,
  49. 0x31ca4bf93cab68b8,
  50. 0xfbad37a125735ba,
  51. 0x9d3a9caaf1ac9e0a,
  52. 0x4f265810f020c095,
  53. 0x6a84c9524e81a8bc,
  54. 0x68ba410537925c79,
  55. 0x422604631b34b07a,
  56. 0x28e3a001f62f8290,
  57. 0x3adfdccb8f734d41,
  58. 0x73503e539baec66a,
  59. 0xe8c1fd0142d9849c,
  60. 0xe204ac13660546c5,
  61. 0x8e2bb3ea97a40c53,
  62. 0xac2800d1bf56548c,
  63. 0x9494dca005d180d0,
  64. 0xf36e1d066383ef53,
  65. 0x8aa35b97a0e03c04,
  66. 0xcf42a59addbd1f0c,
  67. 0xa43ace89f8fdbd79,
  68. 0x37585d8c243870c,
  69. 0x4ab94ee3e26596fe,
  70. 0xcee3abbb50d57b23,
  71. 0xac91a7101a5ec55b,
  72. 0x9173aa8462280d2d,
  73. 0xaec1ca46ccb95105,
  74. 0x57b2f2845db61e4a,
  75. 0x95704158500c90c6,
  76. 0x66e023b0e6c9df5f,
  77. 0x315f63f4fec360ba,
  78. 0xf3009795713abcf1,
  79. 0xf4decc3fb00765ee,
  80. 0x32620ac918682d50,
  81. 0x49717d63a5fc742e,
  82. 0x153516f22014ea2d,
  83. 0xcc316380a2761fe4,
  84. 0x2e49b3f7076d203d,
  85. 0x44ac3e9bf0a2dc89,
  86. 0x49d1e388d8e35c,
  87. 0x53ec867cb39989fa,
  88. 0xd2c9bcc8d65f5a62,
  89. 0xc0cc930ee8540455,
  90. 0x40651e0872505e8,
  91. 0x168973b2ebafbe6c,
  92. 0x9c7eecb3b40581c2,
  93. 0x389473bcdfca97a2,
  94. 0xb1cb0b3abe9753ad,
  95. 0x41afceccffdb18e6,
  96. 0x7bf841e237ccd6c9,
  97. 0x6082a3f101fb888,
  98. 0x8c1a39196f4163cc,
  99. 0xb56664760c1c9476,
  100. 0x2a02ac020d1eb5a3,
  101. 0x6a9d48e8aa83605d,
  102. 0x8a0d2f5c4c9c51b2,
  103. 0x75fc65575b284ad4,
  104. 0xadaedf7d1ce2a8dd,
  105. 0x235bc889cc83968e,
  106. 0xa8c30cf1781738f5,
  107. 0x546b2a846753bcf8,
  108. 0x9b68e8c06c04bd25,
  109. 0x3fdf80794ebb443b,
  110. 0x92ca132a9bec5a45,
  111. 0x76133eecfd9bd1ff,
  112. 0x3fb0fd5381054812,
  113. 0xf15925978dbd52ff,
  114. 0x2ee289ac37f0e879,
  115. 0xd8af8654e9a2e659,
  116. 0x8595bbd7f34c5e8a,
  117. 0x206ddbf781e47b2,
  118. 0xe101a767854a2f97,
  119. 0xf4d4f0a01072c996,
  120. 0x197aec2894aab642,
  121. 0x8d0c3911220db49b,
  122. 0xa62a8bad609227ca,
  123. 0x1e4813a7e7b9cbce,
  124. 0x6b547528731244eb,
  125. 0xd08e48512bfea84e,
  126. 0xb2920c88d3885857,
  127. 0x1f0cd5d7a309fcc2,
  128. 0x99a0ea0842fdb4fb,
  129. 0xc227210554b6c53d,
  130. 0x70e5269708f6f3a9,
  131. 0xbe8f71c8c98bb3bd,
  132. 0xf96fb39adc4baaf6,
  133. 0x7f9a7555c60fc6c7,
  134. 0xccaa5446d71fe6a5,
  135. }
  136. p = [][]uint64{
  137. {
  138. 0x19,
  139. 0x78566230aa7cc5d0,
  140. 0xdbf23e50005e7f24,
  141. 0xb4a02c5c826d523e,
  142. 0x466d8f66a8f9fed5,
  143. 0x68da2264f65ec3e,
  144. 0xb59f9ff0ac6d5d78,
  145. 0xcfb03c902d447551,
  146. 0x2044ce14eaf8f5d9,
  147. 0xfb9373c8481e0f0d,
  148. 0x72af70cdcb99214f,
  149. 0xe3ef40eacc6ff78d,
  150. },
  151. {
  152. 0xf,
  153. 0x817bd8a7869ed1b5,
  154. 0x819f2c14a8366b1f,
  155. 0x7a5cf5b7b922e946,
  156. 0x727eca45c8d7bb71,
  157. 0x605a82c52b5ad2f1,
  158. 0x59ccc4d5184bc93a,
  159. 0x66c8bab2096cfd38,
  160. 0xeb4c0ce280c3e935,
  161. 0x17f9202c16676b2f,
  162. 0x9b6e5164ed35d878,
  163. 0x6fadc9347faeee81,
  164. },
  165. {
  166. 0x29,
  167. 0xd267254bea1097f4,
  168. 0x2dc10fce3233f443,
  169. 0xfa9db0de2d852e7a,
  170. 0xde2a0516f8c9d943,
  171. 0xe6fdf23648931b99,
  172. 0x3743057c07a5dbfa,
  173. 0xa6fdb8ebccc51667,
  174. 0x2c4916605e3dea58,
  175. 0xe95c10ae32e05085,
  176. 0x97f9b7d2cfc2ade5,
  177. 0x9b6e5164ed35d878,
  178. },
  179. {
  180. 0x10,
  181. 0x60c33ebd1e023f0a,
  182. 0xdb6945a20d277091,
  183. 0x383dd77e07998487,
  184. 0xe04ea1957ad8305c,
  185. 0xd499fcbf63fbd266,
  186. 0x462269e4b04620a5,
  187. 0x63c9679d8572a867,
  188. 0x81c44e9699915693,
  189. 0x62ecbe05e02433fc,
  190. 0xe95c10ae32e05085,
  191. 0x17f9202c16676b2f,
  192. },
  193. {
  194. 0x2,
  195. 0xa89ef32ae1462322,
  196. 0x77c1a153e73659e8,
  197. 0x2aec981be4b62ed5,
  198. 0xb70fb5f2b4f1f85f,
  199. 0x7c66d474cd2087cb,
  200. 0x39302966be7df654,
  201. 0xb827c807875511c0,
  202. 0xa4daffb3ffd0e78f,
  203. 0x81c44e9699915693,
  204. 0x2c4916605e3dea58,
  205. 0xeb4c0ce280c3e935,
  206. },
  207. {
  208. 0x1c,
  209. 0x6250f5f176d483e7,
  210. 0xaad1255d46e78f07,
  211. 0x8a00c7c83c762584,
  212. 0xc734f3829ed30b0c,
  213. 0xb1a0132288b1619b,
  214. 0x88685b4f0798dfd1,
  215. 0xfc02e869e21b72f8,
  216. 0xb827c807875511c0,
  217. 0x63c9679d8572a867,
  218. 0xa6fdb8ebccc51667,
  219. 0x66c8bab2096cfd38,
  220. },
  221. {
  222. 0xd,
  223. 0xe16a6c1dee3ba347,
  224. 0x13d316e45539aef4,
  225. 0x577e0472764f061d,
  226. 0x226a4dcf5db3316d,
  227. 0x3373035a3ca3dac6,
  228. 0x441f3a3747b5adb7,
  229. 0x88685b4f0798dfd1,
  230. 0x39302966be7df654,
  231. 0x462269e4b04620a5,
  232. 0x3743057c07a5dbfa,
  233. 0x59ccc4d5184bc93a,
  234. },
  235. {
  236. 0xd,
  237. 0xec9730136b7c2c05,
  238. 0xe1ecc5c21eec0646,
  239. 0x956d3c8b5528e064,
  240. 0x6df1d31fa84398f4,
  241. 0xf4898a1a3554ee49,
  242. 0x3373035a3ca3dac6,
  243. 0xb1a0132288b1619b,
  244. 0x7c66d474cd2087cb,
  245. 0xd499fcbf63fbd266,
  246. 0xe6fdf23648931b99,
  247. 0x605a82c52b5ad2f1,
  248. },
  249. {
  250. 0x27,
  251. 0x3cf7c3a39d94c236,
  252. 0x9e62c7d7b000cb0b,
  253. 0xe202be7ad7265af6,
  254. 0x82178371fa5fff69,
  255. 0x6df1d31fa84398f4,
  256. 0x226a4dcf5db3316d,
  257. 0xc734f3829ed30b0c,
  258. 0xb70fb5f2b4f1f85f,
  259. 0xe04ea1957ad8305c,
  260. 0xde2a0516f8c9d943,
  261. 0x727eca45c8d7bb71,
  262. },
  263. {
  264. 0x12,
  265. 0xb4707207455f57e3,
  266. 0x8e1de42b665c6706,
  267. 0xee7b04568203481,
  268. 0xe202be7ad7265af6,
  269. 0x956d3c8b5528e064,
  270. 0x577e0472764f061d,
  271. 0x8a00c7c83c762584,
  272. 0x2aec981be4b62ed5,
  273. 0x383dd77e07998487,
  274. 0xfa9db0de2d852e7a,
  275. 0x7a5cf5b7b922e946,
  276. },
  277. {
  278. 0x22,
  279. 0xaadb39e83e76a9e0,
  280. 0xcd9bf0bd292c5fda,
  281. 0x8e1de42b665c6706,
  282. 0x9e62c7d7b000cb0b,
  283. 0xe1ecc5c21eec0646,
  284. 0x13d316e45539aef4,
  285. 0xaad1255d46e78f07,
  286. 0x77c1a153e73659e8,
  287. 0xdb6945a20d277091,
  288. 0x2dc10fce3233f443,
  289. 0x819f2c14a8366b1f,
  290. },
  291. {
  292. 0x14,
  293. 0x32f8ae916e567d39,
  294. 0xaadb39e83e76a9e0,
  295. 0xb4707207455f57e3,
  296. 0x3cf7c3a39d94c236,
  297. 0xec9730136b7c2c05,
  298. 0xe16a6c1dee3ba347,
  299. 0x6250f5f176d483e7,
  300. 0xa89ef32ae1462322,
  301. 0x60c33ebd1e023f0a,
  302. 0xd267254bea1097f4,
  303. 0x817bd8a7869ed1b5,
  304. },
  305. }
  306. s = []uint64{
  307. 0x19,
  308. 0x3d999c961b7c63b0,
  309. 0x814e82efcd172529,
  310. 0x2421e5d236704588,
  311. 0x887af7d4dd482328,
  312. 0xa5e9c291f6119b27,
  313. 0xbdc52b2676a4b4aa,
  314. 0x64832009d29bcf57,
  315. 0x9c4155174a552cc,
  316. 0x463f9ee03d290810,
  317. 0xc810936e64982542,
  318. 0x43b1c289f7bc3ac,
  319. 0x94877900674181c3,
  320. 0xc6c67cc37a2a2bbd,
  321. 0xd667c2055387940f,
  322. 0xba63a63e94b5ff0,
  323. 0x99460cc41b8f079f,
  324. 0x7ff02375ed524bb3,
  325. 0xea0870b47a8caf0e,
  326. 0xabcad82633b7bc9d,
  327. 0x3b8d135261052241,
  328. 0xfb4515f5e5b0d539,
  329. 0x3ee8011c2b37f77c,
  330. 0x19,
  331. 0x673655aae8be5a8b,
  332. 0xd510fe714f39fa10,
  333. 0x2c68a099b51c9e73,
  334. 0xa667bfa9aa96999d,
  335. 0x4d67e72f063e2108,
  336. 0xf84dde3e6acda179,
  337. 0x40f9cc8c08f80981,
  338. 0x5ead032050097142,
  339. 0x6591b02092d671bb,
  340. 0xe18c71963dd1b7,
  341. 0x8a21bcd24a14218a,
  342. 0xadef3740e71c726,
  343. 0xa37bf67c6f986559,
  344. 0xc6b16f7ed4fa1b00,
  345. 0x6a065da88d8bfc3c,
  346. 0x4cabc0916844b46f,
  347. 0x407faac0f02e78d1,
  348. 0x7a786d9cf0852cf,
  349. 0x42433fb6949a629a,
  350. 0x891682a147ce43b0,
  351. 0x26cfd58e7b003b55,
  352. 0x2bbf0ed7b657acb3,
  353. 0x19,
  354. 0x202800f4addbdc87,
  355. 0xe4b5bdb1cc3504ff,
  356. 0xbe32b32a825596e7,
  357. 0x8e0f68c5dc223b9a,
  358. 0x58022d9e1c256ce3,
  359. 0x584d29227aa073ac,
  360. 0x8b9352ad04bef9e7,
  361. 0xaead42a3f445ecbf,
  362. 0x3c667a1d833a3cca,
  363. 0xda6f61838efa1ffe,
  364. 0xe8f749470bd7c446,
  365. 0x481ac7746b159c67,
  366. 0xe367de32f108e278,
  367. 0x73f260087ad28bec,
  368. 0x5cfc82216bc1bdca,
  369. 0xcaccc870a2663a0e,
  370. 0xdb69cd7b4298c45d,
  371. 0x7bc9e0c57243e62d,
  372. 0x3cc51c5d368693ae,
  373. 0x366b4e8cc068895b,
  374. 0x2bd18715cdabbca4,
  375. 0xa752061c4f33b8cf,
  376. 0x19,
  377. 0xc5b85bab9e5b3869,
  378. 0x45245258aec51cf7,
  379. 0x16e6b8e68b931830,
  380. 0xe2ae0f051418112c,
  381. 0x470e26a0093a65b,
  382. 0x6bef71973a8146ed,
  383. 0x119265be51812daf,
  384. 0xb0be7356254bea2e,
  385. 0x8584defff7589bd7,
  386. 0x3c5fe4aeb1fb52ba,
  387. 0x9e7cd88acf543a5e,
  388. 0xb22d2432b72d5098,
  389. 0x9e18a487f44d2fe4,
  390. 0x4b39e14ce22abd3c,
  391. 0x9e77fde2eb315e0d,
  392. 0xca5e0385fe67014d,
  393. 0xc2cb99bf1b6bddb,
  394. 0x99ec1cd2a4460bfe,
  395. 0x8577a815a2ff843f,
  396. 0x7d80a6b4fd6518a5,
  397. 0xeb6c67123eab62cb,
  398. 0x8f7851650eca21a5,
  399. 0x19,
  400. 0x179be4bba87f0a8c,
  401. 0xacf63d95d8887355,
  402. 0x6696670196b0074f,
  403. 0xd99ddf1fe75085f9,
  404. 0xc2597881fef0283b,
  405. 0xcf48395ee6c54f14,
  406. 0x15226a8e4cd8d3b6,
  407. 0xc053297389af5d3b,
  408. 0x2c08893f0d1580e2,
  409. 0xed3cbcff6fcc5ba,
  410. 0xc82f510ecf81f6d0,
  411. 0x11ba9a1b81718c2a,
  412. 0x9f7d798a3323410c,
  413. 0xa821855c8c1cf5e5,
  414. 0x535e8d6fac0031b2,
  415. 0x404e7c751b634320,
  416. 0xa729353f6e55d354,
  417. 0x4db97d92e58bb831,
  418. 0xb53926c27897bf7d,
  419. 0x965040d52fe115c5,
  420. 0x9565fa41ebd31fd7,
  421. 0xaae4438c877ea8f4,
  422. 0x19,
  423. 0x94b06183acb715cc,
  424. 0x500392ed0d431137,
  425. 0x861cc95ad5c86323,
  426. 0x5830a443f86c4ac,
  427. 0x3b68225874a20a7c,
  428. 0x10b3309838e236fb,
  429. 0x9b77fc8bcd559e2c,
  430. 0xbdecf5e0cb9cb213,
  431. 0x30276f1221ace5fa,
  432. 0x7935dd342764a144,
  433. 0xeac6db520bb03708,
  434. 0x37f4e36af6073c6e,
  435. 0x4edc0918210800e9,
  436. 0xc44998e99eae4188,
  437. 0x9f4310d05d068338,
  438. 0x9ec7fe4350680f29,
  439. 0xc5b2c1fdc0b50874,
  440. 0xa01920c5ef8b2ebe,
  441. 0x59fa6f8bd91d58ba,
  442. 0x8bfc9eb89b515a82,
  443. 0xbe86a7a2555ae775,
  444. 0xcbb8bbaa3810babf,
  445. 0x19,
  446. 0x7186a80551025f8f,
  447. 0x622247557e9b5371,
  448. 0xc4cbe326d1ad9742,
  449. 0x55f1523ac6a23ea2,
  450. 0xa13dfe77a3d52f53,
  451. 0xe30750b6301c0452,
  452. 0x8bd488070a3a32b,
  453. 0xcd800caef5b72ae3,
  454. 0x83329c90f04233ce,
  455. 0xb5b99e6664a0a3ee,
  456. 0x6b0731849e200a7f,
  457. 0x577f9a9e7ee3f9c2,
  458. 0x88c522b949ace7b1,
  459. 0x82f07007c8b72106,
  460. 0x8283d37c6675b50e,
  461. 0x98b074d9bbac1123,
  462. 0x75c56fb7758317c1,
  463. 0xfed24e206052bc72,
  464. 0x26d7c3d1bc07dae5,
  465. 0xf88c5e441e28dbb4,
  466. 0x4fe27f9f96615270,
  467. 0x514d4ba49c2b14fe,
  468. 0x19,
  469. 0xec3fabc192b01799,
  470. 0x382b38cee8ee5375,
  471. 0x3bfb6c3f0e616572,
  472. 0x514abd0cf6c7bc86,
  473. 0x47521b1361dcc546,
  474. 0x178093843f863d14,
  475. 0xad1003c5d28918e7,
  476. 0x738450e42495bc81,
  477. 0xaf947c59af5e4047,
  478. 0x4653fb0685084ef2,
  479. 0x57fde2062ae35bf,
  480. 0xf02a3ac068ee110b,
  481. 0xa3630dafb8ae2d7,
  482. 0xce0dc874eaf9b55c,
  483. 0x9a95f6cff5b55c7e,
  484. 0x626d76abfed00c7b,
  485. 0xa0c1cf1251c204ad,
  486. 0xdaebd3006321052c,
  487. 0x3d4bd48b625a8065,
  488. 0x7f1e584e071f6ed2,
  489. 0x720574f0501caed3,
  490. 0xe3260ba93d23540a,
  491. 0x19,
  492. 0xe376678d843ce55e,
  493. 0x66f3860d7514e7fc,
  494. 0x7817f3dfff8b4ffa,
  495. 0x3929624a9def725b,
  496. 0x126ca37f215a80a,
  497. 0xfce2f5d02762a303,
  498. 0x1bc927375febbad7,
  499. 0x85b481e5243f60bf,
  500. 0x2d3c5f42a39c91a0,
  501. 0x811719919351ae8,
  502. 0xf669de0add993131,
  503. 0xab1cbd41d8c1e335,
  504. 0x9322ed4c0bc2df01,
  505. 0x51c3c0983d4284e5,
  506. 0x94178e291145c231,
  507. 0xfd0f1a973d6b2085,
  508. 0xd427ad96e2b39719,
  509. 0x8a52437fecaac06b,
  510. 0xdc20ee4b8c4c9a80,
  511. 0xa2c98e9549da2100,
  512. 0x1603fe12613db5b6,
  513. 0xe174929433c5505,
  514. 0x19,
  515. 0x7de38bae084da92d,
  516. 0x5b848442237e8a9b,
  517. 0xf6c705da84d57310,
  518. 0x31e6a4bdb6a49017,
  519. 0x889489706e5c5c0f,
  520. 0xe4a205459692a1b,
  521. 0xbac3fa75ee26f299,
  522. 0x5f5894f4057d755e,
  523. 0xb0dc3ecd724bb076,
  524. 0x5e34d8554a6452ba,
  525. 0x4f78fd8c1fdcc5f,
  526. 0x3d4eab2b8ef5f796,
  527. 0xcfff421583896e22,
  528. 0x4143cb32d39ac3d9,
  529. 0x22365051b78a5b65,
  530. 0x6f7fd010d027c9b6,
  531. 0xd9dd36fba77522ab,
  532. 0xa44cf1cb33e37165,
  533. 0x3fc83d3038c86417,
  534. 0xc4588d418e88d270,
  535. 0xce1320f10ab80fe2,
  536. 0xdb5eadbbec18de5d,
  537. 0x19,
  538. 0x4dd19c38779512ea,
  539. 0xdb79ba02704620e9,
  540. 0x92a29a3675a5d2be,
  541. 0xd5177029fe495166,
  542. 0xd32b3298a13330c1,
  543. 0x251c4a3eb2c5f8fd,
  544. 0xe1c48b26e0d98825,
  545. 0x3301d3362a4ffccb,
  546. 0x9bb6c88de8cd178,
  547. 0xdc05b676564f538a,
  548. 0x60192d883e473fee,
  549. 0x1183dfce7c454afd,
  550. 0x21cea4aa3d3ed949,
  551. 0xfce6f70303f2304,
  552. 0x19557d34b55551be,
  553. 0x4c56f689afc5bbc9,
  554. 0xa1e920844334f944,
  555. 0xbad66d423d2ec861,
  556. 0xf318c785dc9e0479,
  557. 0x99e2032e765ddd81,
  558. 0x400ccc9906d66f45,
  559. 0xe1197454db2e0dd9,
  560. 0x19,
  561. 0x16b9774801ac44a0,
  562. 0x3cb8411e786d3c8e,
  563. 0xa86e9cf505072491,
  564. 0x178928152e109ae,
  565. 0x5317b905a6e1ab7b,
  566. 0xda20b3be7f53d59f,
  567. 0xcb97dedecebee9ad,
  568. 0x4bd545218c59f58d,
  569. 0x77dc8d856c05a44a,
  570. 0x87948589e4f243fd,
  571. 0x7e5217af969952c2,
  572. 0x84d1ecc4d53d2ff1,
  573. 0xd8af8b9ceb4e11b6,
  574. 0x335856bb527b52f4,
  575. 0xc756f17fb59be595,
  576. 0xc0654e4ea5553a78,
  577. 0x9e9a46b61f2ea942,
  578. 0x14fc8b5b3b809127,
  579. 0xd7009f0f103be413,
  580. 0x3e0ee7b7a9fb4601,
  581. 0xa74e888922085ed7,
  582. 0xe80a7cde3d4ac526,
  583. 0x19,
  584. 0xbc58987d06a84e4d,
  585. 0xb5d420244c9cae3,
  586. 0xa3c4711b938c02c0,
  587. 0x3aace640a3e03990,
  588. 0x865a0f3249aacd8a,
  589. 0x8d00b2a7dbed06c7,
  590. 0x6eacb905beb7e2f8,
  591. 0x45322b216ec3ec7,
  592. 0xeb9de00d594828e6,
  593. 0x88c5f20df9e5c26,
  594. 0xf555f4112b19781f,
  595. 0x238aa6daa612186d,
  596. 0x9137a5c630bad4b4,
  597. 0xc7db3817870c5eda,
  598. 0x217e4f04e5718dc9,
  599. 0xcae814e2817bd99d,
  600. 0xe3292e7ab770a8ba,
  601. 0x7bb36ef70b6b9482,
  602. 0x3c7835fb85bca2d3,
  603. 0xfe2cdf8ee3c25e86,
  604. 0x61b3915ad7274b20,
  605. 0xeab75ca7c918e4ef,
  606. 0x19,
  607. 0xa8cedbff1813d3a7,
  608. 0x50dcaee0fd27d164,
  609. 0xf1cb02417e23bd82,
  610. 0xfaf322786e2abe8b,
  611. 0x937a4315beb5d9b6,
  612. 0x1b18992921a11d85,
  613. 0x7d66c4368b3c497b,
  614. 0xe7946317a6b4e99,
  615. 0xbe4430134182978b,
  616. 0x3771e82493ab262d,
  617. 0xa671690d8095ce82,
  618. 0xd6e15ffc055e154e,
  619. 0xec67881f381a32bf,
  620. 0xfbb1196092bf409c,
  621. 0xdc9d2e07830ba226,
  622. 0x698ef3245ff7988,
  623. 0x194fae2974f8b576,
  624. 0x7a5d9bea6ca4910e,
  625. 0x7aebfea95ccdd1c9,
  626. 0xf9bd38a67d5f0e86,
  627. 0xfa65539de65492d8,
  628. 0xf0dfcbe7653ff787,
  629. 0x19,
  630. 0xb035585f6e929d9d,
  631. 0xba1579c7e219b954,
  632. 0xcb201cf846db4ba3,
  633. 0x287bf9177372cf45,
  634. 0xa350e4f61147d0a6,
  635. 0xd5d0ecfb50bcff99,
  636. 0x2e166aa6c776ed21,
  637. 0xe1e66c991990e282,
  638. 0x662b329b01e7bb38,
  639. 0x8aa674b36144d9a9,
  640. 0xcbabf78f97f95e65,
  641. 0xbd87ad390420258,
  642. 0xad8617bca9e33c8,
  643. 0xc00ad377a1e2666,
  644. 0xac6fc58b3f0518f,
  645. 0xc0cc8a892cc4173,
  646. 0xc210accb117bc21,
  647. 0xb73630dbb46ca18,
  648. 0xc8be4920cbd4a54,
  649. 0xbfe877a21be1690,
  650. 0xae790559b0ded81,
  651. 0xbf50db2f8d6ce31,
  652. 0x19,
  653. 0xeec24b15a06b53fe,
  654. 0xc8a7aa07c5633533,
  655. 0xefe9c6fa4311ad51,
  656. 0xb9173f13977109a1,
  657. 0x69ce43c9cc94aedc,
  658. 0xecf623c9cd118815,
  659. 0x28625def198c33c7,
  660. 0xccfc5f7de5c3636a,
  661. 0xf5e6c40f1621c299,
  662. 0xcec0e58c34cb64b1,
  663. 0xa868ea113387939f,
  664. 0xcf29427ff7c58,
  665. 0xbd9b3cf49eec8,
  666. 0xd1dc8aa81fb26,
  667. 0xbc792d5c394ef,
  668. 0xd2ae0b2266453,
  669. 0xd413f12c496c1,
  670. 0xc84128cfed618,
  671. 0xdb5ebd48fc0d4,
  672. 0xd1b77326dcb90,
  673. 0xbeb0ccc145421,
  674. 0xd10e5b22b11d1,
  675. 0x19,
  676. 0xd8dddbdc5ce4ef45,
  677. 0xacfc51de8131458c,
  678. 0x146bb3c0fe499ac0,
  679. 0x9e65309f15943903,
  680. 0x80d0ad980773aa70,
  681. 0xf97817d4ddbf0607,
  682. 0xe4626620a75ba276,
  683. 0xdfdc7fd6fc74f66,
  684. 0xf464864ad6f2bb93,
  685. 0x2d55e52a5d44414,
  686. 0xdd8de62487c40925,
  687. 0xe24c99adad8,
  688. 0xcf389ed4bc8,
  689. 0xe580cbf6966,
  690. 0xcde5fd7e04f,
  691. 0xe63628041b3,
  692. 0xe7e81a87361,
  693. 0xdabe78f6d98,
  694. 0xefb14cac554,
  695. 0xe5574743b10,
  696. 0xd05709f42c1,
  697. 0xe4690c96af1,
  698. 0x19,
  699. 0xc15acf44759545a3,
  700. 0xcbfdcf39869719d4,
  701. 0x33f62042e2f80225,
  702. 0x2599c5ead81d8fa3,
  703. 0xb306cb6c1d7c8d0,
  704. 0x658c80d3df3729b1,
  705. 0xe8d1b2b21b41429c,
  706. 0xa1b67f09d4b3ccb8,
  707. 0xe1adf8b84437180,
  708. 0xd593a5e584af47b,
  709. 0xa023d94c56e151c7,
  710. 0xf7157bc98,
  711. 0xe3006d948,
  712. 0xfa65811e6,
  713. 0xe0d127e2f,
  714. 0xfc18bfe53,
  715. 0xfd002d901,
  716. 0xeed6461d8,
  717. 0x1068562754,
  718. 0xfa0236f50,
  719. 0xe3af13ee1,
  720. 0xfa460f6d1,
  721. 0x19,
  722. 0x49026cc3a4afc5a6,
  723. 0xe06dff00ab25b91b,
  724. 0xab38c561e8850ff,
  725. 0x92c3c8275e105eeb,
  726. 0xb65256e546889bd0,
  727. 0x3c0468236ea142f6,
  728. 0xee61766b889e18f2,
  729. 0xa206f41b12c30415,
  730. 0x2fe9d756c9f12d1,
  731. 0xe9633210630cbf12,
  732. 0x1ffea9fe85a0b0b1,
  733. 0x11131738,
  734. 0xf56d588,
  735. 0x11050f86,
  736. 0xf848f4f,
  737. 0x111527d3,
  738. 0x114369a1,
  739. 0x106f2f38,
  740. 0x11e2ca94,
  741. 0x110a29f0,
  742. 0xfa9f5c1,
  743. 0x10f625d1,
  744. 0x19,
  745. 0x81d1ae8cc50240f3,
  746. 0xf4c77a079a4607d7,
  747. 0xed446b2315e3efc1,
  748. 0xb0a6b70915178c3,
  749. 0xb11ff3e089f15d9a,
  750. 0x1d4dba0b7ae9cc18,
  751. 0x65d74e2f43b48d05,
  752. 0xa2df8c6b8ae0804a,
  753. 0xa4e6f0a8c33348a6,
  754. 0xc0a26efc7be5669b,
  755. 0xa6b6582c547d0d60,
  756. 0x11f718,
  757. 0x10b6c8,
  758. 0x134a96,
  759. 0x10cf7f,
  760. 0x124d03,
  761. 0x13f8a1,
  762. 0x117c58,
  763. 0x132c94,
  764. 0x134fc0,
  765. 0x10a091,
  766. 0x128961,
  767. 0x19,
  768. 0x84afc741f1c13213,
  769. 0x2f8f43734fc906f3,
  770. 0xde682d72da0a02d9,
  771. 0xbb005236adb9ef2,
  772. 0x5bdf35c10a8b5624,
  773. 0x739a8a343950010,
  774. 0x52f515f44785cfbc,
  775. 0xcbaf4e5d82856c60,
  776. 0xac9ea09074e3e150,
  777. 0x8f0fa011a2035fb0,
  778. 0x1a37905d8450904a,
  779. 0x1300,
  780. 0x1750,
  781. 0x114e,
  782. 0x131f,
  783. 0x167b,
  784. 0x1371,
  785. 0x1230,
  786. 0x182c,
  787. 0x1368,
  788. 0xf31,
  789. 0x15c9,
  790. 0x19,
  791. 0x3abeb80def61cc85,
  792. 0x9d19c9dd4eac4133,
  793. 0x75a652d9641a985,
  794. 0x9daf69ae1b67e667,
  795. 0x364f71da77920a18,
  796. 0x50bd769f745c95b1,
  797. 0xf223d1180dbbf3fc,
  798. 0x2f885e584e04aa99,
  799. 0xb69a0fa70aea684a,
  800. 0x9584acaa6e062a0,
  801. 0xbc051640145b19b,
  802. 0x14,
  803. 0x22,
  804. 0x12,
  805. 0x27,
  806. 0xd,
  807. 0xd,
  808. 0x1c,
  809. 0x2,
  810. 0x10,
  811. 0x29,
  812. 0xf,
  813. }
  814. // C is a constant array of element
  815. C []*ffg.Element
  816. // M is a matrix
  817. M [][]*ffg.Element
  818. // P is a matrix
  819. P [][]*ffg.Element
  820. // S is a array of element
  821. S []*ffg.Element
  822. )
  823. func init() {
  824. for i := 0; i < len(c); i++ {
  825. C = append(C, ffg.NewElementFromUint64(c[i]))
  826. }
  827. for i := 0; i < len(s); i++ {
  828. S = append(S, ffg.NewElementFromUint64(s[i]))
  829. }
  830. for i := 0; i < mLen; i++ {
  831. var (
  832. mRow []*ffg.Element
  833. pRow []*ffg.Element
  834. )
  835. for j := 0; j < mLen; j++ {
  836. ele := ffg.NewElementFromUint64(mcirc[(i-j+mLen)%mLen])
  837. if i == j {
  838. ele = ffg.NewElementFromUint64(mcirc[0] + mdiag[i])
  839. }
  840. mRow = append(mRow, ele)
  841. pRow = append(pRow, ffg.NewElementFromUint64(p[i][j]))
  842. }
  843. M = append(M, mRow)
  844. P = append(P, pRow)
  845. }
  846. }