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.

951 lines
24 KiB

  1. package poseidon
  2. import "github.com/iden3/go-iden3-crypto/ffg"
  3. const (
  4. NROUNDSF = 8 //nolint:golint
  5. NROUNDSP = 22 //nolint:golint
  6. CAPLEN = 4 //nolint:golint
  7. mLen = 12
  8. )
  9. var (
  10. mcirc = []uint64{17, 15, 41, 16, 2, 28, 13, 13, 39, 18, 34, 20}
  11. mdiag = []uint64{8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
  12. c = []uint64{
  13. 0xb585f766f2144405, 0x7746a55f43921ad7, 0xb2fb0d31cee799b4, 0x0f6760a4803427d7,
  14. 0xe10d666650f4e012, 0x8cae14cb07d09bf1, 0xd438539c95f63e9f, 0xef781c7ce35b4c3d,
  15. 0xcdc4a239b0c44426, 0x277fa208bf337bff, 0xe17653a29da578a1, 0xc54302f225db2c76,
  16. 0x86287821f722c881, 0x59cd1a8a41c18e55, 0xc3b919ad495dc574, 0xa484c4c5ef6a0781,
  17. 0x308bbd23dc5416cc, 0x6e4a40c18f30c09c, 0x9a2eedb70d8f8cfa, 0xe360c6e0ae486f38,
  18. 0xd5c7718fbfc647fb, 0xc35eae071903ff0b, 0x849c2656969c4be7, 0xc0572c8c08cbbbad,
  19. 0xe9fa634a21de0082, 0xf56f6d48959a600d, 0xf7d713e806391165, 0x8297132b32825daf,
  20. 0xad6805e0e30b2c8a, 0xac51d9f5fcf8535e, 0x502ad7dc18c2ad87, 0x57a1550c110b3041,
  21. 0x66bbd30e6ce0e583, 0x0da2abef589d644e, 0xf061274fdb150d61, 0x28b8ec3ae9c29633,
  22. 0x92a756e67e2b9413, 0x70e741ebfee96586, 0x019d5ee2af82ec1c, 0x6f6f2ed772466352,
  23. 0x7cf416cfe7e14ca1, 0x61df517b86a46439, 0x85dc499b11d77b75, 0x4b959b48b9c10733,
  24. 0xe8be3e5da8043e57, 0xf5c0bc1de6da8699, 0x40b12cbf09ef74bf, 0xa637093ecb2ad631,
  25. 0x3cc3f892184df408, 0x2e479dc157bf31bb, 0x6f49de07a6234346, 0x213ce7bede378d7b,
  26. 0x5b0431345d4dea83, 0xa2de45780344d6a1, 0x7103aaf94a7bf308, 0x5326fc0d97279301,
  27. 0xa9ceb74fec024747, 0x27f8ec88bb21b1a3, 0xfceb4fda1ded0893, 0xfac6ff1346a41675,
  28. 0x7131aa45268d7d8c, 0x9351036095630f9f, 0xad535b24afc26bfb, 0x4627f5c6993e44be,
  29. 0x645cf794b8f1cc58, 0x241c70ed0af61617, 0xacb8e076647905f1, 0x3737e9db4c4f474d,
  30. 0xe7ea5e33e75fffb6, 0x90dee49fc9bfc23a, 0xd1b1edf76bc09c92, 0x0b65481ba645c602,
  31. 0x99ad1aab0814283b, 0x438a7c91d416ca4d, 0xb60de3bcc5ea751c, 0xc99cab6aef6f58bc,
  32. 0x69a5ed92a72ee4ff, 0x5e7b329c1ed4ad71, 0x5fc0ac0800144885, 0x32db829239774eca,
  33. 0x0ade699c5830f310, 0x7cc5583b10415f21, 0x85df9ed2e166d64f, 0x6604df4fee32bcb1,
  34. 0xeb84f608da56ef48, 0xda608834c40e603d, 0x8f97fe408061f183, 0xa93f485c96f37b89,
  35. 0x6704e8ee8f18d563, 0xcee3e9ac1e072119, 0x510d0e65e2b470c1, 0xf6323f486b9038f0,
  36. 0x0b508cdeffa5ceef, 0xf2417089e4fb3cbd, 0x60e75c2890d15730, 0xa6217d8bf660f29c,
  37. 0x7159cd30c3ac118e, 0x839b4e8fafead540, 0x0d3f3e5e82920adc, 0x8f7d83bddee7bba8,
  38. 0x780f2243ea071d06, 0xeb915845f3de1634, 0xd19e120d26b6f386, 0x016ee53a7e5fecc6,
  39. 0xcb5fd54e7933e477, 0xacb8417879fd449f, 0x9c22190be7f74732, 0x5d693c1ba3ba3621,
  40. 0xdcef0797c2b69ec7, 0x3d639263da827b13, 0xe273fd971bc8d0e7, 0x418f02702d227ed5,
  41. 0x8c25fda3b503038c, 0x2cbaed4daec8c07c, 0x5f58e6afcdd6ddc2, 0x284650ac5e1b0eba,
  42. 0x635b337ee819dab5, 0x9f9a036ed4f2d49f, 0xb93e260cae5c170e, 0xb0a7eae879ddb76d,
  43. 0xd0762cbc8ca6570c, 0x34c6efb812b04bf5, 0x40bf0ab5fa14c112, 0xb6b570fc7c5740d3,
  44. 0x5a27b9002de33454, 0xb1a5b165b6d2b2d2, 0x8722e0ace9d1be22, 0x788ee3b37e5680fb,
  45. 0x14a726661551e284, 0x98b7672f9ef3b419, 0xbb93ae776bb30e3a, 0x28fd3b046380f850,
  46. 0x30a4680593258387, 0x337dc00c61bd9ce1, 0xd5eca244c7a4ff1d, 0x7762638264d279bd,
  47. 0xc1e434bedeefd767, 0x0299351a53b8ec22, 0xb2d456e4ad251b80, 0x3e9ed1fda49cea0b,
  48. 0x2972a92ba450bed8, 0x20216dd77be493de, 0xadffe8cf28449ec6, 0x1c4dbb1c4c27d243,
  49. 0x15a16a8a8322d458, 0x388a128b7fd9a609, 0x2300e5d6baedf0fb, 0x2f63aa8647e15104,
  50. 0xf1c36ce86ecec269, 0x27181125183970c9, 0xe584029370dca96d, 0x4d9bbc3e02f1cfb2,
  51. 0xea35bc29692af6f8, 0x18e21b4beabb4137, 0x1e3b9fc625b554f4, 0x25d64362697828fd,
  52. 0x5a3f1bb1c53a9645, 0xdb7f023869fb8d38, 0xb462065911d4e1fc, 0x49c24ae4437d8030,
  53. 0xd793862c112b0566, 0xaadd1106730d8feb, 0xc43b6e0e97b0d568, 0xe29024c18ee6fca2,
  54. 0x5e50c27535b88c66, 0x10383f20a4ff9a87, 0x38e8ee9d71a45af8, 0xdd5118375bf1a9b9,
  55. 0x775005982d74d7f7, 0x86ab99b4dde6c8b0, 0xb1204f603f51c080, 0xef61ac8470250ecf,
  56. 0x1bbcd90f132c603f, 0x0cd1dabd964db557, 0x11a3ae5beb9d1ec9, 0xf755bfeea585d11d,
  57. 0xa3b83250268ea4d7, 0x516306f4927c93af, 0xddb4ac49c9efa1da, 0x64bb6dec369d4418,
  58. 0xf9cc95c22b4c1fcc, 0x08d37f755f4ae9f6, 0xeec49b613478675b, 0xf143933aed25e0b0,
  59. 0xe4c5dd8255dfc622, 0xe7ad7756f193198e, 0x92c2318b87fff9cb, 0x739c25f8fd73596d,
  60. 0x5636cac9f16dfed0, 0xdd8f909a938e0172, 0xc6401fe115063f5b, 0x8ad97b33f1ac1455,
  61. 0x0c49366bb25e8513, 0x0784d3d2f1698309, 0x530fb67ea1809a81, 0x410492299bb01f49,
  62. 0x139542347424b9ac, 0x9cb0bd5ea1a1115e, 0x02e3f615c38f49a1, 0x985d4f4a9c5291ef,
  63. 0x775b9feafdcd26e7, 0x304265a6384f0f2d, 0x593664c39773012c, 0x4f0a2e5fb028f2ce,
  64. 0xdd611f1000c17442, 0xd8185f9adfea4fd0, 0xef87139ca9a3ab1e, 0x3ba71336c34ee133,
  65. 0x7d3a455d56b70238, 0x660d32e130182684, 0x297a863f48cd1f43, 0x90e0a736a751ebb7,
  66. 0x549f80ce550c4fd3, 0x0f73b2922f38bd64, 0x16bf1f73fb7a9c3f, 0x6d1f5a59005bec17,
  67. 0x02ff876fa5ef97c4, 0xc5cb72a2a51159b0, 0x8470f39d2d5c900e, 0x25abb3f1d39fcb76,
  68. 0x23eb8cc9b372442f, 0xd687ba55c64f6364, 0xda8d9e90fd8ff158, 0xe3cbdc7d2fe45ea7,
  69. 0xb9a8c9b3aee52297, 0xc0d28a5c10960bd3, 0x45d7ac9b68f71a34, 0xeeb76e397069e804,
  70. 0x3d06c8bd1514e2d9, 0x9c9c98207cb10767, 0x65700b51aedfb5ef, 0x911f451539869408,
  71. 0x7ae6849fbc3a0ec6, 0x3bb340eba06afe7e, 0xb46e9d8b682ea65e, 0x8dcf22f9a3b34356,
  72. 0x77bdaeda586257a7, 0xf19e400a5104d20d, 0xc368a348e46d950f, 0x9ef1cd60e679f284,
  73. 0xe89cd854d5d01d33, 0x5cd377dc8bb882a2, 0xa7b0fb7883eee860, 0x7684403ec392950d,
  74. 0x5fa3f06f4fed3b52, 0x8df57ac11bc04831, 0x2db01efa1e1e1897, 0x54846de4aadb9ca2,
  75. 0xba6745385893c784, 0x541d496344d2c75b, 0xe909678474e687fe, 0xdfe89923f6c9c2ff,
  76. 0xece5a71e0cfedc75, 0x5ff98fd5d51fe610, 0x83e8941918964615, 0x5922040b47f150c1,
  77. 0xf97d750e3dd94521, 0x5080d4c2b86f56d7, 0xa7de115b56c78d70, 0x6a9242ac87538194,
  78. 0xf7856ef7f9173e44, 0x2265fc92feb0dc09, 0x17dfc8e4f7ba8a57, 0x9001a64209f21db8,
  79. 0x90004c1371b893c5, 0xb932b7cf752e5545, 0xa0b1df81b6fe59fc, 0x8ef1dd26770af2c2,
  80. 0x0541a4f9cfbeed35, 0x9e61106178bfc530, 0xb3767e80935d8af2, 0x0098d5782065af06,
  81. 0x31d191cd5c1466c7, 0x410fefafa319ac9d, 0xbdf8f242e316c4ab, 0x9e8cd55b57637ed0,
  82. 0xde122bebe9a39368, 0x4d001fd58f002526, 0xca6637000eb4a9f8, 0x2f2339d624f91f78,
  83. 0x6d1a7918c80df518, 0xdf9a4939342308e9, 0xebc2151ee6c8398c, 0x03cc2ba8a1116515,
  84. 0xd341d037e840cf83, 0x387cb5d25af4afcc, 0xbba2515f22909e87, 0x7248fe7705f38e47,
  85. 0x4d61e56a525d225a, 0x262e963c8da05d3d, 0x59e89b094d220ec2, 0x055d5b52b78b9c5e,
  86. 0x82b27eb33514ef99, 0xd30094ca96b7ce7b, 0xcf5cb381cd0a1535, 0xfeed4db6919e5a7c,
  87. 0x41703f53753be59f, 0x5eeea940fcde8b6f, 0x4cd1f1b175100206, 0x4a20358574454ec0,
  88. 0x1478d361dbbf9fac, 0x6f02dc07d141875c, 0x296a202ed8e556a2, 0x2afd67999bf32ee5,
  89. 0x7acfd96efa95491d, 0x6798ba0c0abb2c6d, 0x34c6f57b26c92122, 0x5736e1bad206b5de,
  90. 0x20057d2a0056521b, 0x3dea5bd5d0578bd7, 0x16e50d897d4634ac, 0x29bff3ecb9b7a6e3,
  91. 0x475cd3205a3bdcde, 0x18a42105c31b7e88, 0x023e7414af663068, 0x15147108121967d7,
  92. 0xe4a3dff1d7d6fef9, 0x01a8d1a588085737, 0x11b4c74eda62beef, 0xe587cc0d69a73346,
  93. 0x1ff7327017aa2a6e, 0x594e29c42473d06b, 0xf6f31db1899b12d5, 0xc02ac5e47312d3ca,
  94. 0xe70201e960cb78b8, 0x6f90ff3b6a65f108, 0x42747a7245e7fa84, 0xd1f507e43ab749b2,
  95. 0x1c86d265f15750cd, 0x3996ce73dd832c1c, 0x8e7fba02983224bd, 0xba0dec7103255dd4,
  96. 0x9e9cbd781628fc5b, 0xdae8645996edd6a5, 0xdebe0853b1a1d378, 0xa49229d24d014343,
  97. 0x7be5b9ffda905e1c, 0xa3c95eaec244aa30, 0x0230bca8f4df0544, 0x4135c2bebfe148c6,
  98. 0x166fc0cc438a3c72, 0x3762b59a8ae83efa, 0xe8928a4c89114750, 0x2a440b51a4945ee5,
  99. 0x80cefd2b7d99ff83, 0xbb9879c6e61fd62a, 0x6e7c8f1a84265034, 0x164bb2de1bbeddc8,
  100. 0xf3c12fe54d5c653b, 0x40b9e922ed9771e2, 0x551f5b0fbe7b1840, 0x25032aa7c4cb1811,
  101. 0xaaed34074b164346, 0x8ffd96bbf9c9c81d, 0x70fc91eb5937085c, 0x7f795e2a5f915440,
  102. 0x4543d9df5476d3cb, 0xf172d73e004fc90d, 0xdfd1c4febcc81238, 0xbc8dfb627fe558fc,
  103. }
  104. cOpt = []uint64{
  105. 0xb585f766f2144405,
  106. 0x7746a55f43921ad7,
  107. 0xb2fb0d31cee799b4,
  108. 0xf6760a4803427d7,
  109. 0xe10d666650f4e012,
  110. 0x8cae14cb07d09bf1,
  111. 0xd438539c95f63e9f,
  112. 0xef781c7ce35b4c3d,
  113. 0xcdc4a239b0c44426,
  114. 0x277fa208bf337bff,
  115. 0xe17653a29da578a1,
  116. 0xc54302f225db2c76,
  117. 0xac6c9c2b4418dd61,
  118. 0xe0888eb1e8a01286,
  119. 0x813dbe952b98904e,
  120. 0xcc3033609c9cf175,
  121. 0x72cebc82a59c0f82,
  122. 0x8150d8525753e741,
  123. 0xb1122c74b268d66e,
  124. 0x7c6ddd482375aa2,
  125. 0xa4dd6f1ef49fb6af,
  126. 0xd33b0d5b4f7ccfe5,
  127. 0xc523112247209124,
  128. 0x464804200134c32d,
  129. 0xcd09dea180de4f2c,
  130. 0xadb069225c93e4e6,
  131. 0xbf01209b8a7c8534,
  132. 0xb1eb37d319913823,
  133. 0xdadf943b8d3e5a0d,
  134. 0x6d15f3cb7a3520ba,
  135. 0xf07af62b134ef181,
  136. 0x568355076c6b0de6,
  137. 0x31ca4bf93cab68b8,
  138. 0xfbad37a125735ba,
  139. 0x9d3a9caaf1ac9e0a,
  140. 0x4f265810f020c095,
  141. 0x6a84c9524e81a8bc,
  142. 0x68ba410537925c79,
  143. 0x422604631b34b07a,
  144. 0x28e3a001f62f8290,
  145. 0x3adfdccb8f734d41,
  146. 0x73503e539baec66a,
  147. 0xe8c1fd0142d9849c,
  148. 0xe204ac13660546c5,
  149. 0x8e2bb3ea97a40c53,
  150. 0xac2800d1bf56548c,
  151. 0x9494dca005d180d0,
  152. 0xf36e1d066383ef53,
  153. 0x8aa35b97a0e03c04,
  154. 0xcf42a59addbd1f0c,
  155. 0xa43ace89f8fdbd79,
  156. 0x37585d8c243870c,
  157. 0x4ab94ee3e26596fe,
  158. 0xcee3abbb50d57b23,
  159. 0xac91a7101a5ec55b,
  160. 0x9173aa8462280d2d,
  161. 0xaec1ca46ccb95105,
  162. 0x57b2f2845db61e4a,
  163. 0x95704158500c90c6,
  164. 0x66e023b0e6c9df5f,
  165. 0x315f63f4fec360ba,
  166. 0xf3009795713abcf1,
  167. 0xf4decc3fb00765ee,
  168. 0x32620ac918682d50,
  169. 0x49717d63a5fc742e,
  170. 0x153516f22014ea2d,
  171. 0xcc316380a2761fe4,
  172. 0x2e49b3f7076d203d,
  173. 0x44ac3e9bf0a2dc89,
  174. 0x49d1e388d8e35c,
  175. 0x53ec867cb39989fa,
  176. 0xd2c9bcc8d65f5a62,
  177. 0xc0cc930ee8540455,
  178. 0x40651e0872505e8,
  179. 0x168973b2ebafbe6c,
  180. 0x9c7eecb3b40581c2,
  181. 0x389473bcdfca97a2,
  182. 0xb1cb0b3abe9753ad,
  183. 0x41afceccffdb18e6,
  184. 0x7bf841e237ccd6c9,
  185. 0x6082a3f101fb888,
  186. 0x8c1a39196f4163cc,
  187. 0xb56664760c1c9476,
  188. 0x2a02ac020d1eb5a3,
  189. 0x6a9d48e8aa83605d,
  190. 0x8a0d2f5c4c9c51b2,
  191. 0x75fc65575b284ad4,
  192. 0xadaedf7d1ce2a8dd,
  193. 0x235bc889cc83968e,
  194. 0xa8c30cf1781738f5,
  195. 0x546b2a846753bcf8,
  196. 0x9b68e8c06c04bd25,
  197. 0x3fdf80794ebb443b,
  198. 0x92ca132a9bec5a45,
  199. 0x76133eecfd9bd1ff,
  200. 0x3fb0fd5381054812,
  201. 0xf15925978dbd52ff,
  202. 0x2ee289ac37f0e879,
  203. 0xd8af8654e9a2e659,
  204. 0x8595bbd7f34c5e8a,
  205. 0x206ddbf781e47b2,
  206. 0xe101a767854a2f97,
  207. 0xf4d4f0a01072c996,
  208. 0x197aec2894aab642,
  209. 0x8d0c3911220db49b,
  210. 0xa62a8bad609227ca,
  211. 0x1e4813a7e7b9cbce,
  212. 0x6b547528731244eb,
  213. 0xd08e48512bfea84e,
  214. 0xb2920c88d3885857,
  215. 0x1f0cd5d7a309fcc2,
  216. 0x99a0ea0842fdb4fb,
  217. 0xc227210554b6c53d,
  218. 0x70e5269708f6f3a9,
  219. 0xbe8f71c8c98bb3bd,
  220. 0xf96fb39adc4baaf6,
  221. 0x7f9a7555c60fc6c7,
  222. 0xccaa5446d71fe6a5,
  223. }
  224. p = [][]uint64{
  225. {
  226. 0x19,
  227. 0x78566230aa7cc5d0,
  228. 0xdbf23e50005e7f24,
  229. 0xb4a02c5c826d523e,
  230. 0x466d8f66a8f9fed5,
  231. 0x68da2264f65ec3e,
  232. 0xb59f9ff0ac6d5d78,
  233. 0xcfb03c902d447551,
  234. 0x2044ce14eaf8f5d9,
  235. 0xfb9373c8481e0f0d,
  236. 0x72af70cdcb99214f,
  237. 0xe3ef40eacc6ff78d,
  238. },
  239. {
  240. 0xf,
  241. 0x817bd8a7869ed1b5,
  242. 0x819f2c14a8366b1f,
  243. 0x7a5cf5b7b922e946,
  244. 0x727eca45c8d7bb71,
  245. 0x605a82c52b5ad2f1,
  246. 0x59ccc4d5184bc93a,
  247. 0x66c8bab2096cfd38,
  248. 0xeb4c0ce280c3e935,
  249. 0x17f9202c16676b2f,
  250. 0x9b6e5164ed35d878,
  251. 0x6fadc9347faeee81,
  252. },
  253. {
  254. 0x29,
  255. 0xd267254bea1097f4,
  256. 0x2dc10fce3233f443,
  257. 0xfa9db0de2d852e7a,
  258. 0xde2a0516f8c9d943,
  259. 0xe6fdf23648931b99,
  260. 0x3743057c07a5dbfa,
  261. 0xa6fdb8ebccc51667,
  262. 0x2c4916605e3dea58,
  263. 0xe95c10ae32e05085,
  264. 0x97f9b7d2cfc2ade5,
  265. 0x9b6e5164ed35d878,
  266. },
  267. {
  268. 0x10,
  269. 0x60c33ebd1e023f0a,
  270. 0xdb6945a20d277091,
  271. 0x383dd77e07998487,
  272. 0xe04ea1957ad8305c,
  273. 0xd499fcbf63fbd266,
  274. 0x462269e4b04620a5,
  275. 0x63c9679d8572a867,
  276. 0x81c44e9699915693,
  277. 0x62ecbe05e02433fc,
  278. 0xe95c10ae32e05085,
  279. 0x17f9202c16676b2f,
  280. },
  281. {
  282. 0x2,
  283. 0xa89ef32ae1462322,
  284. 0x77c1a153e73659e8,
  285. 0x2aec981be4b62ed5,
  286. 0xb70fb5f2b4f1f85f,
  287. 0x7c66d474cd2087cb,
  288. 0x39302966be7df654,
  289. 0xb827c807875511c0,
  290. 0xa4daffb3ffd0e78f,
  291. 0x81c44e9699915693,
  292. 0x2c4916605e3dea58,
  293. 0xeb4c0ce280c3e935,
  294. },
  295. {
  296. 0x1c,
  297. 0x6250f5f176d483e7,
  298. 0xaad1255d46e78f07,
  299. 0x8a00c7c83c762584,
  300. 0xc734f3829ed30b0c,
  301. 0xb1a0132288b1619b,
  302. 0x88685b4f0798dfd1,
  303. 0xfc02e869e21b72f8,
  304. 0xb827c807875511c0,
  305. 0x63c9679d8572a867,
  306. 0xa6fdb8ebccc51667,
  307. 0x66c8bab2096cfd38,
  308. },
  309. {
  310. 0xd,
  311. 0xe16a6c1dee3ba347,
  312. 0x13d316e45539aef4,
  313. 0x577e0472764f061d,
  314. 0x226a4dcf5db3316d,
  315. 0x3373035a3ca3dac6,
  316. 0x441f3a3747b5adb7,
  317. 0x88685b4f0798dfd1,
  318. 0x39302966be7df654,
  319. 0x462269e4b04620a5,
  320. 0x3743057c07a5dbfa,
  321. 0x59ccc4d5184bc93a,
  322. },
  323. {
  324. 0xd,
  325. 0xec9730136b7c2c05,
  326. 0xe1ecc5c21eec0646,
  327. 0x956d3c8b5528e064,
  328. 0x6df1d31fa84398f4,
  329. 0xf4898a1a3554ee49,
  330. 0x3373035a3ca3dac6,
  331. 0xb1a0132288b1619b,
  332. 0x7c66d474cd2087cb,
  333. 0xd499fcbf63fbd266,
  334. 0xe6fdf23648931b99,
  335. 0x605a82c52b5ad2f1,
  336. },
  337. {
  338. 0x27,
  339. 0x3cf7c3a39d94c236,
  340. 0x9e62c7d7b000cb0b,
  341. 0xe202be7ad7265af6,
  342. 0x82178371fa5fff69,
  343. 0x6df1d31fa84398f4,
  344. 0x226a4dcf5db3316d,
  345. 0xc734f3829ed30b0c,
  346. 0xb70fb5f2b4f1f85f,
  347. 0xe04ea1957ad8305c,
  348. 0xde2a0516f8c9d943,
  349. 0x727eca45c8d7bb71,
  350. },
  351. {
  352. 0x12,
  353. 0xb4707207455f57e3,
  354. 0x8e1de42b665c6706,
  355. 0xee7b04568203481,
  356. 0xe202be7ad7265af6,
  357. 0x956d3c8b5528e064,
  358. 0x577e0472764f061d,
  359. 0x8a00c7c83c762584,
  360. 0x2aec981be4b62ed5,
  361. 0x383dd77e07998487,
  362. 0xfa9db0de2d852e7a,
  363. 0x7a5cf5b7b922e946,
  364. },
  365. {
  366. 0x22,
  367. 0xaadb39e83e76a9e0,
  368. 0xcd9bf0bd292c5fda,
  369. 0x8e1de42b665c6706,
  370. 0x9e62c7d7b000cb0b,
  371. 0xe1ecc5c21eec0646,
  372. 0x13d316e45539aef4,
  373. 0xaad1255d46e78f07,
  374. 0x77c1a153e73659e8,
  375. 0xdb6945a20d277091,
  376. 0x2dc10fce3233f443,
  377. 0x819f2c14a8366b1f,
  378. },
  379. {
  380. 0x14,
  381. 0x32f8ae916e567d39,
  382. 0xaadb39e83e76a9e0,
  383. 0xb4707207455f57e3,
  384. 0x3cf7c3a39d94c236,
  385. 0xec9730136b7c2c05,
  386. 0xe16a6c1dee3ba347,
  387. 0x6250f5f176d483e7,
  388. 0xa89ef32ae1462322,
  389. 0x60c33ebd1e023f0a,
  390. 0xd267254bea1097f4,
  391. 0x817bd8a7869ed1b5,
  392. },
  393. }
  394. s = []uint64{
  395. 0x19,
  396. 0x3d999c961b7c63b0,
  397. 0x814e82efcd172529,
  398. 0x2421e5d236704588,
  399. 0x887af7d4dd482328,
  400. 0xa5e9c291f6119b27,
  401. 0xbdc52b2676a4b4aa,
  402. 0x64832009d29bcf57,
  403. 0x9c4155174a552cc,
  404. 0x463f9ee03d290810,
  405. 0xc810936e64982542,
  406. 0x43b1c289f7bc3ac,
  407. 0x94877900674181c3,
  408. 0xc6c67cc37a2a2bbd,
  409. 0xd667c2055387940f,
  410. 0xba63a63e94b5ff0,
  411. 0x99460cc41b8f079f,
  412. 0x7ff02375ed524bb3,
  413. 0xea0870b47a8caf0e,
  414. 0xabcad82633b7bc9d,
  415. 0x3b8d135261052241,
  416. 0xfb4515f5e5b0d539,
  417. 0x3ee8011c2b37f77c,
  418. 0x19,
  419. 0x673655aae8be5a8b,
  420. 0xd510fe714f39fa10,
  421. 0x2c68a099b51c9e73,
  422. 0xa667bfa9aa96999d,
  423. 0x4d67e72f063e2108,
  424. 0xf84dde3e6acda179,
  425. 0x40f9cc8c08f80981,
  426. 0x5ead032050097142,
  427. 0x6591b02092d671bb,
  428. 0xe18c71963dd1b7,
  429. 0x8a21bcd24a14218a,
  430. 0xadef3740e71c726,
  431. 0xa37bf67c6f986559,
  432. 0xc6b16f7ed4fa1b00,
  433. 0x6a065da88d8bfc3c,
  434. 0x4cabc0916844b46f,
  435. 0x407faac0f02e78d1,
  436. 0x7a786d9cf0852cf,
  437. 0x42433fb6949a629a,
  438. 0x891682a147ce43b0,
  439. 0x26cfd58e7b003b55,
  440. 0x2bbf0ed7b657acb3,
  441. 0x19,
  442. 0x202800f4addbdc87,
  443. 0xe4b5bdb1cc3504ff,
  444. 0xbe32b32a825596e7,
  445. 0x8e0f68c5dc223b9a,
  446. 0x58022d9e1c256ce3,
  447. 0x584d29227aa073ac,
  448. 0x8b9352ad04bef9e7,
  449. 0xaead42a3f445ecbf,
  450. 0x3c667a1d833a3cca,
  451. 0xda6f61838efa1ffe,
  452. 0xe8f749470bd7c446,
  453. 0x481ac7746b159c67,
  454. 0xe367de32f108e278,
  455. 0x73f260087ad28bec,
  456. 0x5cfc82216bc1bdca,
  457. 0xcaccc870a2663a0e,
  458. 0xdb69cd7b4298c45d,
  459. 0x7bc9e0c57243e62d,
  460. 0x3cc51c5d368693ae,
  461. 0x366b4e8cc068895b,
  462. 0x2bd18715cdabbca4,
  463. 0xa752061c4f33b8cf,
  464. 0x19,
  465. 0xc5b85bab9e5b3869,
  466. 0x45245258aec51cf7,
  467. 0x16e6b8e68b931830,
  468. 0xe2ae0f051418112c,
  469. 0x470e26a0093a65b,
  470. 0x6bef71973a8146ed,
  471. 0x119265be51812daf,
  472. 0xb0be7356254bea2e,
  473. 0x8584defff7589bd7,
  474. 0x3c5fe4aeb1fb52ba,
  475. 0x9e7cd88acf543a5e,
  476. 0xb22d2432b72d5098,
  477. 0x9e18a487f44d2fe4,
  478. 0x4b39e14ce22abd3c,
  479. 0x9e77fde2eb315e0d,
  480. 0xca5e0385fe67014d,
  481. 0xc2cb99bf1b6bddb,
  482. 0x99ec1cd2a4460bfe,
  483. 0x8577a815a2ff843f,
  484. 0x7d80a6b4fd6518a5,
  485. 0xeb6c67123eab62cb,
  486. 0x8f7851650eca21a5,
  487. 0x19,
  488. 0x179be4bba87f0a8c,
  489. 0xacf63d95d8887355,
  490. 0x6696670196b0074f,
  491. 0xd99ddf1fe75085f9,
  492. 0xc2597881fef0283b,
  493. 0xcf48395ee6c54f14,
  494. 0x15226a8e4cd8d3b6,
  495. 0xc053297389af5d3b,
  496. 0x2c08893f0d1580e2,
  497. 0xed3cbcff6fcc5ba,
  498. 0xc82f510ecf81f6d0,
  499. 0x11ba9a1b81718c2a,
  500. 0x9f7d798a3323410c,
  501. 0xa821855c8c1cf5e5,
  502. 0x535e8d6fac0031b2,
  503. 0x404e7c751b634320,
  504. 0xa729353f6e55d354,
  505. 0x4db97d92e58bb831,
  506. 0xb53926c27897bf7d,
  507. 0x965040d52fe115c5,
  508. 0x9565fa41ebd31fd7,
  509. 0xaae4438c877ea8f4,
  510. 0x19,
  511. 0x94b06183acb715cc,
  512. 0x500392ed0d431137,
  513. 0x861cc95ad5c86323,
  514. 0x5830a443f86c4ac,
  515. 0x3b68225874a20a7c,
  516. 0x10b3309838e236fb,
  517. 0x9b77fc8bcd559e2c,
  518. 0xbdecf5e0cb9cb213,
  519. 0x30276f1221ace5fa,
  520. 0x7935dd342764a144,
  521. 0xeac6db520bb03708,
  522. 0x37f4e36af6073c6e,
  523. 0x4edc0918210800e9,
  524. 0xc44998e99eae4188,
  525. 0x9f4310d05d068338,
  526. 0x9ec7fe4350680f29,
  527. 0xc5b2c1fdc0b50874,
  528. 0xa01920c5ef8b2ebe,
  529. 0x59fa6f8bd91d58ba,
  530. 0x8bfc9eb89b515a82,
  531. 0xbe86a7a2555ae775,
  532. 0xcbb8bbaa3810babf,
  533. 0x19,
  534. 0x7186a80551025f8f,
  535. 0x622247557e9b5371,
  536. 0xc4cbe326d1ad9742,
  537. 0x55f1523ac6a23ea2,
  538. 0xa13dfe77a3d52f53,
  539. 0xe30750b6301c0452,
  540. 0x8bd488070a3a32b,
  541. 0xcd800caef5b72ae3,
  542. 0x83329c90f04233ce,
  543. 0xb5b99e6664a0a3ee,
  544. 0x6b0731849e200a7f,
  545. 0x577f9a9e7ee3f9c2,
  546. 0x88c522b949ace7b1,
  547. 0x82f07007c8b72106,
  548. 0x8283d37c6675b50e,
  549. 0x98b074d9bbac1123,
  550. 0x75c56fb7758317c1,
  551. 0xfed24e206052bc72,
  552. 0x26d7c3d1bc07dae5,
  553. 0xf88c5e441e28dbb4,
  554. 0x4fe27f9f96615270,
  555. 0x514d4ba49c2b14fe,
  556. 0x19,
  557. 0xec3fabc192b01799,
  558. 0x382b38cee8ee5375,
  559. 0x3bfb6c3f0e616572,
  560. 0x514abd0cf6c7bc86,
  561. 0x47521b1361dcc546,
  562. 0x178093843f863d14,
  563. 0xad1003c5d28918e7,
  564. 0x738450e42495bc81,
  565. 0xaf947c59af5e4047,
  566. 0x4653fb0685084ef2,
  567. 0x57fde2062ae35bf,
  568. 0xf02a3ac068ee110b,
  569. 0xa3630dafb8ae2d7,
  570. 0xce0dc874eaf9b55c,
  571. 0x9a95f6cff5b55c7e,
  572. 0x626d76abfed00c7b,
  573. 0xa0c1cf1251c204ad,
  574. 0xdaebd3006321052c,
  575. 0x3d4bd48b625a8065,
  576. 0x7f1e584e071f6ed2,
  577. 0x720574f0501caed3,
  578. 0xe3260ba93d23540a,
  579. 0x19,
  580. 0xe376678d843ce55e,
  581. 0x66f3860d7514e7fc,
  582. 0x7817f3dfff8b4ffa,
  583. 0x3929624a9def725b,
  584. 0x126ca37f215a80a,
  585. 0xfce2f5d02762a303,
  586. 0x1bc927375febbad7,
  587. 0x85b481e5243f60bf,
  588. 0x2d3c5f42a39c91a0,
  589. 0x811719919351ae8,
  590. 0xf669de0add993131,
  591. 0xab1cbd41d8c1e335,
  592. 0x9322ed4c0bc2df01,
  593. 0x51c3c0983d4284e5,
  594. 0x94178e291145c231,
  595. 0xfd0f1a973d6b2085,
  596. 0xd427ad96e2b39719,
  597. 0x8a52437fecaac06b,
  598. 0xdc20ee4b8c4c9a80,
  599. 0xa2c98e9549da2100,
  600. 0x1603fe12613db5b6,
  601. 0xe174929433c5505,
  602. 0x19,
  603. 0x7de38bae084da92d,
  604. 0x5b848442237e8a9b,
  605. 0xf6c705da84d57310,
  606. 0x31e6a4bdb6a49017,
  607. 0x889489706e5c5c0f,
  608. 0xe4a205459692a1b,
  609. 0xbac3fa75ee26f299,
  610. 0x5f5894f4057d755e,
  611. 0xb0dc3ecd724bb076,
  612. 0x5e34d8554a6452ba,
  613. 0x4f78fd8c1fdcc5f,
  614. 0x3d4eab2b8ef5f796,
  615. 0xcfff421583896e22,
  616. 0x4143cb32d39ac3d9,
  617. 0x22365051b78a5b65,
  618. 0x6f7fd010d027c9b6,
  619. 0xd9dd36fba77522ab,
  620. 0xa44cf1cb33e37165,
  621. 0x3fc83d3038c86417,
  622. 0xc4588d418e88d270,
  623. 0xce1320f10ab80fe2,
  624. 0xdb5eadbbec18de5d,
  625. 0x19,
  626. 0x4dd19c38779512ea,
  627. 0xdb79ba02704620e9,
  628. 0x92a29a3675a5d2be,
  629. 0xd5177029fe495166,
  630. 0xd32b3298a13330c1,
  631. 0x251c4a3eb2c5f8fd,
  632. 0xe1c48b26e0d98825,
  633. 0x3301d3362a4ffccb,
  634. 0x9bb6c88de8cd178,
  635. 0xdc05b676564f538a,
  636. 0x60192d883e473fee,
  637. 0x1183dfce7c454afd,
  638. 0x21cea4aa3d3ed949,
  639. 0xfce6f70303f2304,
  640. 0x19557d34b55551be,
  641. 0x4c56f689afc5bbc9,
  642. 0xa1e920844334f944,
  643. 0xbad66d423d2ec861,
  644. 0xf318c785dc9e0479,
  645. 0x99e2032e765ddd81,
  646. 0x400ccc9906d66f45,
  647. 0xe1197454db2e0dd9,
  648. 0x19,
  649. 0x16b9774801ac44a0,
  650. 0x3cb8411e786d3c8e,
  651. 0xa86e9cf505072491,
  652. 0x178928152e109ae,
  653. 0x5317b905a6e1ab7b,
  654. 0xda20b3be7f53d59f,
  655. 0xcb97dedecebee9ad,
  656. 0x4bd545218c59f58d,
  657. 0x77dc8d856c05a44a,
  658. 0x87948589e4f243fd,
  659. 0x7e5217af969952c2,
  660. 0x84d1ecc4d53d2ff1,
  661. 0xd8af8b9ceb4e11b6,
  662. 0x335856bb527b52f4,
  663. 0xc756f17fb59be595,
  664. 0xc0654e4ea5553a78,
  665. 0x9e9a46b61f2ea942,
  666. 0x14fc8b5b3b809127,
  667. 0xd7009f0f103be413,
  668. 0x3e0ee7b7a9fb4601,
  669. 0xa74e888922085ed7,
  670. 0xe80a7cde3d4ac526,
  671. 0x19,
  672. 0xbc58987d06a84e4d,
  673. 0xb5d420244c9cae3,
  674. 0xa3c4711b938c02c0,
  675. 0x3aace640a3e03990,
  676. 0x865a0f3249aacd8a,
  677. 0x8d00b2a7dbed06c7,
  678. 0x6eacb905beb7e2f8,
  679. 0x45322b216ec3ec7,
  680. 0xeb9de00d594828e6,
  681. 0x88c5f20df9e5c26,
  682. 0xf555f4112b19781f,
  683. 0x238aa6daa612186d,
  684. 0x9137a5c630bad4b4,
  685. 0xc7db3817870c5eda,
  686. 0x217e4f04e5718dc9,
  687. 0xcae814e2817bd99d,
  688. 0xe3292e7ab770a8ba,
  689. 0x7bb36ef70b6b9482,
  690. 0x3c7835fb85bca2d3,
  691. 0xfe2cdf8ee3c25e86,
  692. 0x61b3915ad7274b20,
  693. 0xeab75ca7c918e4ef,
  694. 0x19,
  695. 0xa8cedbff1813d3a7,
  696. 0x50dcaee0fd27d164,
  697. 0xf1cb02417e23bd82,
  698. 0xfaf322786e2abe8b,
  699. 0x937a4315beb5d9b6,
  700. 0x1b18992921a11d85,
  701. 0x7d66c4368b3c497b,
  702. 0xe7946317a6b4e99,
  703. 0xbe4430134182978b,
  704. 0x3771e82493ab262d,
  705. 0xa671690d8095ce82,
  706. 0xd6e15ffc055e154e,
  707. 0xec67881f381a32bf,
  708. 0xfbb1196092bf409c,
  709. 0xdc9d2e07830ba226,
  710. 0x698ef3245ff7988,
  711. 0x194fae2974f8b576,
  712. 0x7a5d9bea6ca4910e,
  713. 0x7aebfea95ccdd1c9,
  714. 0xf9bd38a67d5f0e86,
  715. 0xfa65539de65492d8,
  716. 0xf0dfcbe7653ff787,
  717. 0x19,
  718. 0xb035585f6e929d9d,
  719. 0xba1579c7e219b954,
  720. 0xcb201cf846db4ba3,
  721. 0x287bf9177372cf45,
  722. 0xa350e4f61147d0a6,
  723. 0xd5d0ecfb50bcff99,
  724. 0x2e166aa6c776ed21,
  725. 0xe1e66c991990e282,
  726. 0x662b329b01e7bb38,
  727. 0x8aa674b36144d9a9,
  728. 0xcbabf78f97f95e65,
  729. 0xbd87ad390420258,
  730. 0xad8617bca9e33c8,
  731. 0xc00ad377a1e2666,
  732. 0xac6fc58b3f0518f,
  733. 0xc0cc8a892cc4173,
  734. 0xc210accb117bc21,
  735. 0xb73630dbb46ca18,
  736. 0xc8be4920cbd4a54,
  737. 0xbfe877a21be1690,
  738. 0xae790559b0ded81,
  739. 0xbf50db2f8d6ce31,
  740. 0x19,
  741. 0xeec24b15a06b53fe,
  742. 0xc8a7aa07c5633533,
  743. 0xefe9c6fa4311ad51,
  744. 0xb9173f13977109a1,
  745. 0x69ce43c9cc94aedc,
  746. 0xecf623c9cd118815,
  747. 0x28625def198c33c7,
  748. 0xccfc5f7de5c3636a,
  749. 0xf5e6c40f1621c299,
  750. 0xcec0e58c34cb64b1,
  751. 0xa868ea113387939f,
  752. 0xcf29427ff7c58,
  753. 0xbd9b3cf49eec8,
  754. 0xd1dc8aa81fb26,
  755. 0xbc792d5c394ef,
  756. 0xd2ae0b2266453,
  757. 0xd413f12c496c1,
  758. 0xc84128cfed618,
  759. 0xdb5ebd48fc0d4,
  760. 0xd1b77326dcb90,
  761. 0xbeb0ccc145421,
  762. 0xd10e5b22b11d1,
  763. 0x19,
  764. 0xd8dddbdc5ce4ef45,
  765. 0xacfc51de8131458c,
  766. 0x146bb3c0fe499ac0,
  767. 0x9e65309f15943903,
  768. 0x80d0ad980773aa70,
  769. 0xf97817d4ddbf0607,
  770. 0xe4626620a75ba276,
  771. 0xdfdc7fd6fc74f66,
  772. 0xf464864ad6f2bb93,
  773. 0x2d55e52a5d44414,
  774. 0xdd8de62487c40925,
  775. 0xe24c99adad8,
  776. 0xcf389ed4bc8,
  777. 0xe580cbf6966,
  778. 0xcde5fd7e04f,
  779. 0xe63628041b3,
  780. 0xe7e81a87361,
  781. 0xdabe78f6d98,
  782. 0xefb14cac554,
  783. 0xe5574743b10,
  784. 0xd05709f42c1,
  785. 0xe4690c96af1,
  786. 0x19,
  787. 0xc15acf44759545a3,
  788. 0xcbfdcf39869719d4,
  789. 0x33f62042e2f80225,
  790. 0x2599c5ead81d8fa3,
  791. 0xb306cb6c1d7c8d0,
  792. 0x658c80d3df3729b1,
  793. 0xe8d1b2b21b41429c,
  794. 0xa1b67f09d4b3ccb8,
  795. 0xe1adf8b84437180,
  796. 0xd593a5e584af47b,
  797. 0xa023d94c56e151c7,
  798. 0xf7157bc98,
  799. 0xe3006d948,
  800. 0xfa65811e6,
  801. 0xe0d127e2f,
  802. 0xfc18bfe53,
  803. 0xfd002d901,
  804. 0xeed6461d8,
  805. 0x1068562754,
  806. 0xfa0236f50,
  807. 0xe3af13ee1,
  808. 0xfa460f6d1,
  809. 0x19,
  810. 0x49026cc3a4afc5a6,
  811. 0xe06dff00ab25b91b,
  812. 0xab38c561e8850ff,
  813. 0x92c3c8275e105eeb,
  814. 0xb65256e546889bd0,
  815. 0x3c0468236ea142f6,
  816. 0xee61766b889e18f2,
  817. 0xa206f41b12c30415,
  818. 0x2fe9d756c9f12d1,
  819. 0xe9633210630cbf12,
  820. 0x1ffea9fe85a0b0b1,
  821. 0x11131738,
  822. 0xf56d588,
  823. 0x11050f86,
  824. 0xf848f4f,
  825. 0x111527d3,
  826. 0x114369a1,
  827. 0x106f2f38,
  828. 0x11e2ca94,
  829. 0x110a29f0,
  830. 0xfa9f5c1,
  831. 0x10f625d1,
  832. 0x19,
  833. 0x81d1ae8cc50240f3,
  834. 0xf4c77a079a4607d7,
  835. 0xed446b2315e3efc1,
  836. 0xb0a6b70915178c3,
  837. 0xb11ff3e089f15d9a,
  838. 0x1d4dba0b7ae9cc18,
  839. 0x65d74e2f43b48d05,
  840. 0xa2df8c6b8ae0804a,
  841. 0xa4e6f0a8c33348a6,
  842. 0xc0a26efc7be5669b,
  843. 0xa6b6582c547d0d60,
  844. 0x11f718,
  845. 0x10b6c8,
  846. 0x134a96,
  847. 0x10cf7f,
  848. 0x124d03,
  849. 0x13f8a1,
  850. 0x117c58,
  851. 0x132c94,
  852. 0x134fc0,
  853. 0x10a091,
  854. 0x128961,
  855. 0x19,
  856. 0x84afc741f1c13213,
  857. 0x2f8f43734fc906f3,
  858. 0xde682d72da0a02d9,
  859. 0xbb005236adb9ef2,
  860. 0x5bdf35c10a8b5624,
  861. 0x739a8a343950010,
  862. 0x52f515f44785cfbc,
  863. 0xcbaf4e5d82856c60,
  864. 0xac9ea09074e3e150,
  865. 0x8f0fa011a2035fb0,
  866. 0x1a37905d8450904a,
  867. 0x1300,
  868. 0x1750,
  869. 0x114e,
  870. 0x131f,
  871. 0x167b,
  872. 0x1371,
  873. 0x1230,
  874. 0x182c,
  875. 0x1368,
  876. 0xf31,
  877. 0x15c9,
  878. 0x19,
  879. 0x3abeb80def61cc85,
  880. 0x9d19c9dd4eac4133,
  881. 0x75a652d9641a985,
  882. 0x9daf69ae1b67e667,
  883. 0x364f71da77920a18,
  884. 0x50bd769f745c95b1,
  885. 0xf223d1180dbbf3fc,
  886. 0x2f885e584e04aa99,
  887. 0xb69a0fa70aea684a,
  888. 0x9584acaa6e062a0,
  889. 0xbc051640145b19b,
  890. 0x14,
  891. 0x22,
  892. 0x12,
  893. 0x27,
  894. 0xd,
  895. 0xd,
  896. 0x1c,
  897. 0x2,
  898. 0x10,
  899. 0x29,
  900. 0xf,
  901. }
  902. // C is a constant array of element
  903. C []*ffg.Element
  904. // COpt is a constant array of element
  905. COpt []*ffg.Element
  906. // M is a matrix
  907. M [][]*ffg.Element
  908. // P is a matrix
  909. P [][]*ffg.Element
  910. // S is a array of element
  911. S []*ffg.Element
  912. )
  913. func init() {
  914. for i := 0; i < len(c); i++ {
  915. C = append(C, ffg.NewElementFromUint64(c[i]))
  916. }
  917. for i := 0; i < len(cOpt); i++ {
  918. COpt = append(COpt, ffg.NewElementFromUint64(cOpt[i]))
  919. }
  920. for i := 0; i < len(s); i++ {
  921. S = append(S, ffg.NewElementFromUint64(s[i]))
  922. }
  923. for i := 0; i < mLen; i++ {
  924. var (
  925. mRow []*ffg.Element
  926. pRow []*ffg.Element
  927. )
  928. for j := 0; j < mLen; j++ {
  929. ele := ffg.NewElementFromUint64(mcirc[(i-j+mLen)%mLen])
  930. if i == j {
  931. ele = ffg.NewElementFromUint64(mcirc[0] + mdiag[i])
  932. }
  933. mRow = append(mRow, ele)
  934. pRow = append(pRow, ffg.NewElementFromUint64(p[i][j]))
  935. }
  936. M = append(M, mRow)
  937. P = append(P, pRow)
  938. }
  939. }