Poseidon2-BabyBear Constants#
This document provides the round constant arrays and Maximum Distance Separable (MDS) matrix used in the Poseidon2-BabyBear algorithm.
MDS Matrix#
The Maximum Distance Separable (MDS) matrix used in the algorithm is:
\[\begin{split}\begin{bmatrix}
5 & 7 & 1 & 3 \\
4 & 6 & 1 & 1 \\
1 & 3 & 5 & 7 \\
1 & 1 & 4 & 6 \\
\end{bmatrix}\end{split}\]
Width 16#
External Round Constants#
// clang-format off
__constant__ uint32_t external_rc_array_16[8][16] = {
{1774958255, 1185780729, 1621102414, 1796380621, 588815102, 1932426223, 1925334750, 747903232,
89648862, 360728943, 977184635, 1425273457, 256487465, 1200041953, 572403254, 448208942},
{1215789478, 944884184, 953948096, 547326025, 646827752, 889997530, 1536873262, 86189867,
1065944411, 32019634, 333311454, 456061748, 1963448500, 1827584334, 1391160226, 1348741381},
{88424255, 104111868, 1763866748, 79691676, 1988915530, 1050669594, 359890076, 573163527,
222820492, 159256268, 669703072, 763177444, 889367200, 256335831, 704371273, 25886717},
{51754520, 1833211857, 454499742, 1384520381, 777848065, 1053320300, 1851729162, 344647910,
401996362, 1046925956, 5351995, 1212119315, 754867989, 36972490, 751272725, 506915399},
{1922082829, 1870549801, 1502529704, 1990744480, 1700391016, 1702593455, 321330495, 528965731,
183414327, 1886297254, 1178602734, 1923111974, 744004766, 549271463, 1781349648, 542259047},
{1536158148, 715456982, 503426110, 340311124, 1558555932, 1226350925, 742828095, 1338992758,
1641600456, 1843351545, 301835475, 43203215, 386838401, 1520185679, 1235297680, 904680097},
{1491801617, 1581784677, 913384905, 247083962, 532844013, 107190701, 213827818, 1979521776,
1358282574, 1681743681, 1867507480, 1530706910, 507181886, 695185447, 1172395131, 1250800299},
{1503161625, 817684387, 498481458, 494676004, 1404253825, 108246855, 59414691, 744214112,
890862029, 1342765939, 1417398904, 1897591937, 1066647396, 1682806907, 1015795079, 1619482808}
};
Internal Round Constants#
__constant__ uint32_t internal_rc_array_16[13] = {
1518359488, 1765533241, 945325693, 422793067, 311365592,
1311448267, 1629555936, 1009879353, 190525218, 786108885,
557776863, 212616710, 605745517
};
Internal Diagonal Constants#
__constant__ uint32_t internal_diag_array_16[16] = {
174271892, 1840666551, 1459346590, 86719882,
863261185, 1543704716, 199992187, 629943947,
302161721, 1766394318, 1831016228, 566473250,
1007223973, 30846170, 661675139, 1378994178
};
Width 24#
External Round Constants#
__constant__ uint32_t external_rc_array_24[8][24] = {
{262278199, 127253399, 314968988, 246143118, 157582794, 118043943, 454905424, 815798990,
1004040026, 1773108264, 1066694495, 1930780904, 1180307149, 1464793095, 1660766320, 1389166148,
343354132, 1307439985, 638242172, 525458520, 1964135730, 1751797115, 1421525369, 831813382},
{695835963, 1845603984, 540703332, 1333667262, 1917861751, 1170029417, 1989924532, 1518763784,
1339793538, 622609176, 686842369, 1737016378, 1282239129, 897025192, 716894289, 1997503974,
395622276, 1201063290, 1917549072, 1150912935, 1687379185, 1507936940, 241306552, 989176635},
{1147522062, 27129487, 1257820264, 142102402, 217046702, 1664590951, 855276054, 1215259350,
946500736, 552696906, 1424297384, 538103555, 1608853840, 162510541, 623051854, 1549062383,
1908416316, 1622328571, 1079030649, 1584033957, 1099252725, 1910423126, 447555988, 862495875},
{128479034, 1587822577, 608401422, 1290028279, 342857858, 825405577, 427731030, 1718628547,
588764636, 204228775, 1454563174, 1740472809, 1338899225, 1269493554, 53007114, 1647670797,
306391314, 172614232, 51256176, 1221257987, 1239734761, 273790406, 1781980094, 1291790245},
{53041581, 723038058, 1439947916, 1136469704, 205609311, 1883820770, 14387587, 720724951,
1854174607, 1629316321, 530151394, 1679178250, 1549779579, 48375137, 976057819, 463976218,
875839332, 1946596189, 434078361, 1878280202, 1363837384, 1470845646, 1792450386, 1040977421},
{1209164052, 714957516, 390340387, 1213686459, 790726260, 117294666, 140621810, 993455846,
1889603648, 78845751, 925018226, 708123747, 1647665372, 1649953458, 942439428, 1006235079,
238616145, 930036496, 1401020792, 989618631, 1545325389, 1715719711, 755691969, 150307788},
{1567618575, 1663353317, 1950429111, 1891637550, 192082241, 1080533265, 1463323727, 890243564,
158646617, 1402624179, 59510015, 1198261138, 1065075039, 1150410028, 1293938517, 76770019,
1478577620, 1748789933, 457372011, 1841795381, 760115692, 1042892522, 1507649755, 1827572010},
{1206940496, 1896271507, 1003792297, 738091882, 1124078057, 1889898, 813674331, 228520958,
1832911930, 781141772, 459826664, 202271745, 1296144415, 1111203133, 1090783436, 641665156,
1393671120, 1303271640, 809508074, 162506101, 1262312258, 1672219447, 1608891156, 1380248020}
};
Internal Round Constants#
__constant__ uint32_t internal_rc_array_24[21] = {
497520322, 1930103076, 1052077299, 1540960371, 924863639, 1365519753,
1726563304, 440300254, 1891545577, 822033215, 1111544260, 308575117,
1708681573, 1240419708, 1199068823, 1186174623, 1551596046, 1886977120,
1327682690, 1210751726, 1810596765
};
Internal Diagonal Constants#
__constant__ uint32_t internal_diag_array_24[24] = {
1083257840, 375892129, 111593398, 1867716110, 658182609, 51866717,
1928969209, 1942928017, 1558116381, 20525701, 1188752902, 106789798,
1389833583, 98371040, 1001081699, 1792686146, 801504236, 1997365680,
1461037801, 65998480, 1974912880, 606789471, 13683276, 918610824
};