Merge pull request #45 from daira/poseidon-rounds-update

Update Poseidon instantiation from 58 to 56 partial rounds.
This commit is contained in:
str4d 2021-08-05 14:24:20 +01:00 committed by GitHub
commit c00b8f2472
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 85 additions and 218 deletions

View File

@ -1,5 +1,6 @@
from orchard_pallas import Fp
import numpy as np
from itertools import chain
from utils import leos2ip
from tv_output import render_args, render_tv
from tv_rand import Rand
@ -7,7 +8,7 @@ from tv_rand import Rand
# Number of full rounds
R_F = 8
# Number of partial rounds
R_P = 58
R_P = 56
# Width
t = 3
@ -47,249 +48,115 @@ def perm(input_words):
for i in range(0, t):
state_words[i] = (state_words[i]).exp(5)
state_words = list(np.array(MDS_MATRIX).dot(np.array(state_words, dtype=object)))
return state_words
# Round constants generated by the reference implementation script, commit 659de89
# https://extgit.iaik.tugraz.at/krypto/hadeshash/-/blob/master/code/generate_parameters_grain.sage
#
# $ sage generate_parameters_grain.sage 1 0 255 3 8 58 0x40000000000000000000000000000000224698fc094cf91b992d30ed00000001
ROUND_CONSTANTS = [
Fp(0x2f2c2bfbd7070f5321f103387216cb9137df4021c68b5eef61904c0511b737a4),
Fp(0x04ec2fc5c55d67746ccdd22b2bbdead13645b63b123b613afb311b7d0f35b058),
Fp(0x3c624cfc4c994eb2fa9b924125223a7163e46dfb62f3522b6771be5f74ecb0b6),
Fp(0x3476744a626a1813dd9b91a3d9031e29ccecd6c12a34927a5a936dc45b059511),
Fp(0x3e8e3c1b8e9f1e1809d3b2dc9dc078894e4c8c3fdf34ea1a033e60bd7a63cf16),
Fp(0x1439f41af8953e20247a437c362bba132af9c485bc73d98a4be1bb1b9efd907c),
Fp(0x2184e123d6f4e5e9fea44f9f1ee27531af57eb3128f8662193ac3d2ca4ac6c7a),
Fp(0x331019b909d6c87d8cc034f568aedbe1f8e05b9293c9b396a3eda4c816729416),
Fp(0x00078b16de3fa3a0c6ec9cff8656ad7ed1eba2586b779d45a53f26c9a84fa24e),
Fp(0x394f742117539cad1d44ff024f9f4e7a85782423cf7fd1305bc1b2926f39601e),
Fp(0x261e237d617e261a6e65df293f2725e00311e30e0ba5c3008ed576fd4d43d779),
Fp(0x252d1389b3aefdd233dccb6f7c448319857d2f7b4075d28b4513b401f48a3668),
Fp(0x025ca9dda3db70df67bf7e430350923d38d635392451923af69df9e788a5fe24),
Fp(0x1d2c2ace140ad5b617e517edd753f0b18d152f5c95421ab6c18c127223501f93),
Fp(0x0ba495c1f7b77dbf654c7abd86a684434079eb21f42e4af06768c8403f50ac2c),
Fp(0x2cbce44950324cba5bb2f8664192273205f15752efc3ebe1d8af60702eef9e28),
Fp(0x24767e0d3abf426d95e4242db16d3a33fe5e302a8a71c31c671afb22aeae9d14),
Fp(0x1acd6ef0e60e4b14146d53fcc83aea81b8a971e0ba9daab50d928670de2a3031),
Fp(0x340f94d400bd0a3119942055672d627da17e77a8a72e7eedcc1c86114da6a1eb),
Fp(0x0327373cca3dd2f8d60711e33e0c6b82472c8da29209c94dd51e2326061e22c0),
Fp(0x1d1041d82c9d480f17c2d6ae049061e939ee18190c5c20805fdb2ffcf0161350),
Fp(0x0de4750f968b5257895e8c73611059f8b7d135501d3d911f51bc31436ab5a574),
Fp(0x359290a3786196bbc7fc9a99c916ccba11454b0cd0eb7d3fb2414383ee1a5794),
Fp(0x28ffcdddf417cbabba580e1453f3094ddd4460b67aef036418c20b5cec2e8036),
Fp(0x0e76c3df688ed3f5de99a4e4dcc1308486010174246d3c89322d2c6afaab6a00),
Fp(0x172ca76af974367abde18a6b3a19c2ef7c42ac6e80e97c5b78922912d57f57c7),
Fp(0x12ed4668b1543521662601e168f1a7aa8951a8407b00fd3f9b64fa4dc692195f),
Fp(0x0c2ea06a9894cea56fd7211f8354d5092f614f7bcf8232ef90f2a829e538d398),
Fp(0x0faea60318136b64e54759689b038ae3b55d8ea1305494517c7fea109bb09622),
Fp(0x1beaeb465cd4c711b93eebf4dd9a414f1e7b90098c78a371287bfe86a1e66b27),
Fp(0x351c94b9bcca5b1a2c2b06ede8114d463b6f7bdd6b37dd97a81add76cd42a4e3),
Fp(0x2a1838fac1749e4fe68f84dcf259a459bb6ed62b92328294dcfc4ebaa75a4d92),
Fp(0x3f875c2cd7e1d69ea4f88c06ea9c2ab893418cf02a66ea98cd230bfae2f670fb),
Fp(0x31224a3412529b86145fe811a3fc44860ddd35b287fdc7986ce237b7c99f07a1),
Fp(0x1556b2b9633ae623b42a1119bfbae23e0d6ee24b4e39c55c615b6db29fd9314e),
Fp(0x399bacd8f54ccc4d1ce8ca1c71e5fb346aff3ab03e93551975225cd9ed99f2c2),
Fp(0x389877368a5c321ea02d7dabc1444ad131c43e3ad4d20ebaf2f0997bbbaf80e3),
Fp(0x0ef32660742991bbc6d17e9a4132067f6f78fa39361a74ccaebc66a50a73b506),
Fp(0x1e491a5fdda824e26eb3d15a465c9221fb7a99f01266cbe86d97adb2c1139c94),
Fp(0x2de4d6ff6ff2634b6ae7ab72cc34eb48c6ad0f62f31397e8a07d60fafe7f0aa7),
Fp(0x1283a38005b8f0a7f2a5b56138dd2a5bbf319eac78d2c93506dbddfcdba52766),
Fp(0x19e2efea5020aa4be092ca71681d8050b3c91a960025c6acdf23b7b398f061b6),
Fp(0x287fb567ece35108f55719af51c11b6b610968a14a94ce030b7f48248fec885d),
Fp(0x2761ea586e5d500d5202d4483f10d32a587f25e1e974432d59800355f507bb83),
Fp(0x2f77d7a4f74db35eaf18b1bd8786f740f85d793979ae02c46d529cb31dff100e),
Fp(0x0390862d7e6e7a690d4a5e120b9dc8f13200eb324f5d7c33d34b68245ebf1dc2),
Fp(0x14d5b21da4b45c808c2a51c11a9cc97fd5196ea5d70bbdb6352e4174565c5a52),
Fp(0x2974ad78ec5d90fbd088112a178403a1acb796e31fc8737f3f8566c9d7d1e755),
Fp(0x36b58f7052adcc1fa3a1c290f0b04b7a28b413c7a3bb7e68ffb53b785334ee3c),
Fp(0x2efb0a9efd6c60a1aeb870093f64363919c4993eb1fd95ae97159cc8a97339c2),
Fp(0x1f04ae7df249c70c3f19a23c72a2a102d1528ff7aa4bb02229b61e805c98c1ff),
Fp(0x278d44fe8f8c299659642e54f819858991fd0d3b8c617d8a1363315c4d8e0cb0),
Fp(0x1a2bbd022168061c49b45714ae1b0f6a6ded5b7f8cefc2a2e3344dc1c1592406),
Fp(0x0f0de2f73193a97edf8a91de8e688793f93cb4ed2236639813ebf947a3559f9c),
Fp(0x3ac47dc248f16ac55092c3d232a09399b76cd699d0b30adf0072ef68ea438f92),
Fp(0x1f7f927daef5fc95f4a0c96759812f90002c2347a222043cb3c779653e34a054),
Fp(0x250b4faf86d72618e6e3cd02b1adcb7c945c315ce93dfc00c0b179e1cc950b85),
Fp(0x07c64646dee2604b62528967df12153f7288bcc4fab6750d65d20118981ade0e),
Fp(0x24cbbd234c0ef70078fa143ca1158bbba05c8ca1dd7132efee93af96dbadff1d),
Fp(0x208edf94ef339a27fdbbf3cc08b7adecc5362d39b6348ecc54bb4e6cf7fa521b),
Fp(0x3ea2a73f40f1f3d20a589d3d2c4d14dbf45f11963d6c1806f96c7fd82a46da35),
Fp(0x36ccb8567075d3a0771bb857f4c51f58e79cb26ff91b9be15973a73ea2752c7a),
Fp(0x08654b649a5091baa9cdf91ce7f831473adc95de617cfa32fc8681d17000408c),
Fp(0x2b58a76bcbfb8500f28b308ee52a8e0ea5fac865c5b6ee7da9898bed507f18ea),
Fp(0x1001d34a284e2b254614b66105ccb699e2ed8f2533be8e737d15896225d59a2e),
Fp(0x13375ab0b5350afb2f1e63d230afa70c2a61dece93b1651c9c4286cc6354bc9c),
Fp(0x2a7169d46ff2ffbaec72491a04c64702ac5b9ccb5216abda5622b222a0f0aacb),
Fp(0x033eb55bedfd6b29986094724c1852f651d214174045e6fc55eace8b62101ae0),
Fp(0x10ca1ffa20260f4019e31226ee751c71795c7f74d5d1c53b5ec053879568fad1),
Fp(0x06c1da78f2f5f0fde46172c42bbc83e3495d5082cf47489df1f0980430bd6854),
Fp(0x1ae9bf0085d1a2b7fdd8999c542447243b4e83b509a3975cf74a4bab5a21c53f),
Fp(0x368599e0cc709b2d07542c631e002e81d38be406010a91c1cbdbeb71eec5383c),
Fp(0x02e79429cc4d4a362e02d60c365dcb49898f32679397244222788138e9584f32),
Fp(0x18c541e9d2751b8000d3998ad9c220db4a4315eb87d99b67a0a82bd61d49d14d),
Fp(0x197507d5e313e2e3b49b9fb54a89a586447443b5f9d9292b01c9bf579600678e),
Fp(0x26b1bd92ee8931886696164e25e700926f470f7041be91abbffc4f5fddbdc07f),
Fp(0x0efdb615f564ee4698d8f8f44deaed092681d0a23a4577724d8cad71a7e5fdbe),
Fp(0x266a5dddc5f832887a71bdbe32594a48ac9f2bccf1fa8d4368144a5fc771da1c),
Fp(0x34f356e3badb42d5e17d8e2df0917f29b575fb420a344f56b32a9caaf6168330),
Fp(0x2fa9ad6f882f66ccddd716c5b3f04c48f138f015bc0d0d5a258b3a63f45ebcaf),
Fp(0x210b633386cdd22784f4fc53939bed4d7350958aac95be44b2ab8c35890dcd99),
Fp(0x34dc0f069165b00e4e80ab1639afaf610937f9d6cf91437dd6a56d62f6ad9eb3),
Fp(0x259b4cb0b0861d0782d0614ae013d8c7913fa6f411c7dc733326b0455cf8778c),
Fp(0x0f88d8b6c5d9073dc660788b3e78bd62315abaf489d41b29a7d0770ead395746),
Fp(0x30abd11ecb73119f5baef3db5d9337853282e45af42d83c72084d439504c1fc6),
Fp(0x3152ce325264529cf302af09d5baec045efc980abba7cc3363a18839c6f6446f),
Fp(0x00bd3146554e552abe94978eddc451ede2954fc59859ff6c34f7c1613c270e35),
Fp(0x2c1ef4c8ef911a32ee1cea96ee50922815a93afae282c149b7f24921d8d4a0fe),
Fp(0x23869adb5876af5f29721a01deb5335bbdd8bc446d7bebcd32966e61c7ad12b3),
Fp(0x2af88e261ca1217caccdf61ac128cb35f372cb64c6bed49de2ea4991a83e5559),
Fp(0x1b5d76d6c03da588a257ecf10b3daaf6a40dcea8f7f097f180c9c434914cb08a),
Fp(0x1c76daae2af0990fcfc6bd3d2f027c3afe599fc476202d0a37d08e8f023b6285),
Fp(0x2f5893f6a6e2ef3d3bbb3577ca09d9f059e5b761f25218adb85ea92c8328797f),
Fp(0x1a11a3dc16874116e894488c79ff537033278958606472301833029f73094c23),
Fp(0x22b2a9a84c555a46ed9149261eac2db8cde06b75292c4777f7c9a6bd81c2000e),
Fp(0x1f7201ee492876c172204d8f5e4ee22e6f6f98348d77c85b93398ca5a5e8bbaa),
Fp(0x08e2edc6fbdc691f2512ee311910c8f8211eab318f4142dcf636c50cf6fdd861),
Fp(0x173726c1c53a38abb250c6578359c6a4df0a181b9932230703df22f761e06616),
Fp(0x2ffe9110497cdee27d1ed33019291435729a8410c1e2548989580351e3878456),
Fp(0x02f1f99037148d41dad15fb86a6279d9e4fd5bd65a738f7f8de1001ed1cc4478),
Fp(0x0a2c4dbf4da2980ef04af6cfb2e6f0a897d0126dc4eb15da86b3f413408e73c7),
Fp(0x2970b9d63a8db9247913597bd93be23a14fa3c81edcfcf8d363cf0c61f2bc143),
Fp(0x0400e59387ee438d69a2bf80aa738769de9a8b955210901a771ed118571f65c1),
Fp(0x25be6a88f910a398bc614b938890be42dad6b1ac8ec6fe112a613b399eef6665),
Fp(0x03ea4bdf101fd9344899d113fc1741fbad74ca8b334dc53a6b729a6a5fc89279),
Fp(0x1047fad9b32efea09b218f282aa1c2dfd3077303195f57fc41418934d16f1c4f),
Fp(0x0a8765e82791f0faf6ffcf3f7dde261ccc6aa4c2a2de1b55342174c08f0e99ac),
Fp(0x2326fa25a0ebdced43fd78b1caa01bc4c6a1dde08c7df91df5898f39574e3d46),
Fp(0x1b1a9c596960319532ab8d8ef1ccc26863c469e98f0e7f429dec33c3a37a4a02),
Fp(0x3b298d20b11005609eaa5f9acf0a480936c068f6550ffea10c21ae5e15d6dcf4),
Fp(0x15776a393f3d75ee488a42e8d5f26f94aaca4d924128005ea7c870bb617025f3),
Fp(0x062e8dab4d237e8aac0cf2e2d173cedf70cecf5a6a12220e27d197845e9b8bff),
Fp(0x00719d1b34cda84f510cc767022945e2f68588e8f5e42277292036c710a489b7),
Fp(0x0f901761fa7e00162f1792c3e496c93af19e59a3cb7150c434bddbb672467d41),
Fp(0x18f39bd02bcc22f43f769a14a7c3d54f88705c9760c58f3260264363487fe0c4),
Fp(0x167608824f7f125fee60341f3c2f281fc25d04280d69a9bb082060d5bef32e60),
Fp(0x2f9d3358af7e3bcfd8eaa88240f1c586a5bf90eaab88e7168ba0a876454c3de2),
Fp(0x32ac45a37e1686ae18a69f252ba9c5136adc6096c706e318079d6a3febcf9e3b),
Fp(0x2f8951ae3f289d7e113dcb80a1fa1bd8ebae53212e629d3355ccd0c322d7de32),
Fp(0x33a9c0aa4190b15f92dce5f89ae2377c8673f2235a4efc40ef6dd647040a65fe),
Fp(0x16dc7bbb45d732435378dd6ee7ee0e554f6712f07f43ad5d98e814d28ef68fc0),
Fp(0x2859b4d0a15abff3a2dc781fdc4b935214b694d3a60b6d6106b016f2516b9ff7),
Fp(0x291e7534b1ac0d4406761253e857b2179607c6dba3dc47ec32c27f4cf8384cb1),
Fp(0x25cab0613937bf2c23ce32f9566f0613afcadfe206a9a1149bce91aef428bf67),
Fp(0x05d75d4ba225bd59f3331b3d67b41c7b9dab05fef552102193119a37cf39651d),
Fp(0x08f1ac492aeaeb4097fd3b925c1cb260dd1b0de49f51890f6c4280c5c8fffdb2),
Fp(0x1930f19bb3162224797e85bde05fbe51fb0fb9498581ea286d420f57bbac4a5c),
Fp(0x30976bf9c5ba0385aacfabdf761ac8dbe36b4db7d6d3cf54bf01921c50187dad),
Fp(0x24565e3c889e675e3d0bcdfaa7bce677dfecea8651ec61a4c750da24f2957c5d),
Fp(0x1b4963d6634d1aa4e94f3558cc6ef85b0ebb63d1313e6f414c0688bb35b4a84d),
Fp(0x11c6317226ebefe1861b3c281de88796102a81c5275019fed8b855e1fec7601c),
Fp(0x31e4caa72b128088d729b7ac24f75e3efdd4494111f52a2fe03f84aa7a812b35),
Fp(0x28f0c2c9dc75d8595d3d0534c8f653c59d78c4f1d61a6d01f79600fa0211a509),
Fp(0x2d2ed9e6560537731793ba72151ed438c589d66d722f11179c6f63ff9ba1a43d),
Fp(0x2d82d12d5502c57ef739aa08c19863ec2e8d9047e90b4a36db9885982dec47a0),
Fp(0x37ca663122f8f8c3a37b3550d9e209e01695e6fe0408ed4c37e04c1235607016),
Fp(0x23aea613927e92f3fdaa11f448aa594e9e41f1f98fdd90e8752299919a064262),
Fp(0x35a32d064403f6c210a8afcd345d4e1224e6f95457b7ea81ef5f02a7ddca9494),
Fp(0x10dd3772c90dfb82066fe616175cbc524dd89298011e50963a1c403f537409db),
Fp(0x16888fc7306379753b28c52902a5dee5f477c341db2de6a33e11d8aeb0ace075),
Fp(0x157487d36ab5b7c6198597efa84f66ef6ec597050032a368f561d150c7313263),
Fp(0x09db68595b17923ba8a23d8903f5c74509625055fe9bcb616227c476ee639d21),
Fp(0x268093fe30f176392b15441318708c596d785da591fe71044f6bb0bb740131bf),
Fp(0x2bcdbeb28b4ace35527bcdc578eec161c123c2bcf66eae255f531cd376953963),
Fp(0x15fb7e0badca6d8712d1af8b0008b7bafbe39694bb5bb4e4de6192fa1a7457e0),
Fp(0x17bc5b91ab0d42c97986e17f662463d094299bb9637561d9b972bf424ec6a34d),
Fp(0x28ba3b752ddd1219fbad933f9509769ac5bfef2caf73a21bb906b04df55e3332),
Fp(0x08c21be5da0797c93a9e9daf6c264cd477383c7661434bc7c2f3a5352ba0a6a6),
Fp(0x1368f9ecd178721b5da1a907b0f3d71e200f12f522980391f20f0093dd5bfa1d),
Fp(0x3964872808c60d5e11816d402f286afba6124eae232767d0aa338c8598170874),
Fp(0x1980d8064cb2b4054394a51fe4399eabafe85e7ff4708b5a4719a8ea4c4d7c8b),
Fp(0x17d3146dfdcc73a6e08468feea777763e92d094a07af1dc5a4dacee9bba18392),
Fp(0x096dd2795c0238507f51a9768d9b1016c7ba5faf4b62466051929aaeaa1f059f),
Fp(0x253d45b9f0ba5d8e51715eb65d213af10eda2f755fab8728905f76534b6e4d0b),
Fp(0x0c43204d8daf1fcf7dfe6b82afaa9233659a2a33fe857c5b49d0fcad93df0814),
Fp(0x1c896e0a96d7fd26fe24af6714ff5ac1da9d65a87f2627369164030f84f4f704),
Fp(0x294086bc2cea0bc9d4789b02f826e55671927b6af97f22e6a7b9e18334de48b9),
Fp(0x23e409c460e1df98f65ad1838207d9072085c987b907ed49669fabec34dfde7d),
Fp(0x0474f59587e52aba53892fdc8946d032b7d6fac1e5483f42be71f83c2a4c3aa6),
Fp(0x3cbaf27040837d2ea1dd59a9b58b11aaf86d966d85873a5ea2368fb2845c0058),
Fp(0x363f69f61694ce239688c02475cdde1812532d7c27d865c20226357c51d8caa9),
Fp(0x1a1906f6e6948159a14692c58aab7b8e2e9737617d4c6d77bd6d470d0b0eaba9),
Fp(0x3f55112d29d0cd0a9ea3aae537dc9f49474dac9ea9413da7b13524a8891189e2),
Fp(0x35ac2c37ec045706ba15b5947c45bda8f438b525608ac8bba02dd7168474ccde),
Fp(0x0c7687e1da1a9ab943d4a724cc4def7f7825dc7a2f52dffe6b8b23f394c331eb),
Fp(0x05e98545421d5e7675d54080f03e1f99afca04fee1d626b4057584c00e3821cb),
Fp(0x2e0b8eaafcab9b619a0ee226784693fb926285b86c63187cd9b78df979c137ac),
Fp(0x05c76e8712141f4a273c7823c42dccc2d35b9e4fa3999a6a9607aa13ed44daf0),
Fp(0x2fa7be72d0672174ea06940be2c634d63a17a833b534d6fe8b2a481c56ba9c0c),
Fp(0x0fb76439139350676499dfa370c128a81210de574d4c2fee6f7811f5054cdbde),
Fp(0x25ad36d3824b9c3c8fa469f96a5c0dc1ebd3f4455a2436ce596e2345784f68d0),
Fp(0x2ea618635d2a84e31019fef58cc70312876f6a03f6d14fc75c0232e3bcd86646),
Fp(0x0a933a7699746381c04de2d48886b1b812868044b458cb5ad5f176c628464f21),
Fp(0x1fc6239cbbc29822338b6074929322b406edf6fcefd1348143131baccc08b134),
Fp(0x193c32e133cf528a86cb203712db7076337ffca197d02ef3b3a11859ee5fd06c),
Fp(0x30d5c435da0e541f283675b526312a9c253c589f5e755dacfc21f04634ea4f51),
Fp(0x1c13311054b300af3d1d960ab3bad127795c963c687d26faee16fd3a6ae75a8a),
Fp(0x037af3e4d8a5d338195f1302cc689dc5d2475b375733cb1e319bef549efedc8f),
Fp(0x061fc5d5b4e67dd100503e21915502159e7b7465656512c3ff11799a7caad0fa),
Fp(0x2e9d62d787b4ddd9e520f78200eab0b1ee86b7455720c6192e4745475bb8d98d),
Fp(0x260b46ed156d2ab096759a7078137f7d561257719b44b41f366422a8a9fed3f1),
Fp(0x004686cfcd1f9f1f86f89d31140b9246966cc8c22a358012ce6e5ea49f6e3e60),
Fp(0x332edeaa879008c6a6865ccdc93ddc30b58882d346b409a6bf4a0139570f5744),
Fp(0x01ba4b76d0d08294a5546d21e7dfe47407fed94c329c0b11e6cbbc56a1cc0a00),
Fp(0x2eac30427fcf4f551c2eed718f9949d5f8914a820dcc8548e6db8d3b60455b92),
Fp(0x303c32bf49d73ea9bd95119666e4aa96fdd1cc8ba0e38bd02c3dba8195ee2eee),
Fp(0x0e1cc1e02632ef1abb31810712c3fb08c94b0b3569cf7446cbd8e21b9841fb66),
Fp(0x33051496b670bebaba4fc21b529556cb4ba2045e3347c6105cafdaf696e67e7e),
Fp(0x0eaba3f40a2c53cd90a7f44431e217ea01e7572aca00e12465f908808b4202f0),
Fp(0x0b01e425270ec4f3d4810b0395cd422ac96ed1a3c8eedc8c8b02bc51ec68a656),
Fp(0x133f84bf2658613979ceca9514f5c4c3fe8448e7d92088c17ebcffa2b473a674),
Fp(0x3cbdf49b42e4c2a512987260f2327ea02739e1e2db9a462a7fe1f95e8b8c3dd2),
Fp(0x2d38b041fc5379cc67db3544a2bf6a17d63396b16af9a2ba30492c0982ebed07),
Fp(0x3ae6480f450154a60be0da12998d3bdeadfcfee0c8fac2167c091bfb3d26dd25),
Fp(0x01ace40f25423f2c2a7005641a6a1d2d3066e72bb10b457010579b58eac52105),
Fp(0x1212fa565936b14ffea2b74ba21379ccb28ce22d6ad899932ef97c7899c68028),
Fp(0x2166389a0e4e1f364627f44f183c91e19a0f302972d3b542faae23893d5f50fd),
Fp(0x0ade42a791fef5cf2c386d2df993e84538576cf565d379e8a3be16b562d755c2)
]
# $ sage generate_parameters_grain.sage 1 0 255 3 8 56 0x40000000000000000000000000000000224698fc094cf91b992d30ed00000001
ROUND_CONSTANTS = [Fp(x) for x in chain.from_iterable([
[0x360d7470611e473d353f628f76d110f34e71162f31003b7057538c2596426303, 0x2bab94d7ae222d135dc3c6c5febfaa314908ac2f12ebe06fbdb74213bf63188b, 0x150c93fef652fb1c2bf03e1a29aa871fef77e7d736766c5d0939d92753cc5dc8],
[0x3270661e68928b3a955d55db56dc57c103cc0a60141e894e14259dce537782b2, 0x073f116f04122e25a0b7afe4e2057299b407c370f2b5a1ccce9fb9ffc345afb3, 0x2a32ec5c4ee5b1837affd09c1f53f5fd55c9cd2061ae93ca8ebad76fc71554d8],
[0x270326ee039df19e651e2cfc740628ca634d24fc6e2559f22d8ccbe292efeead, 0x27c6642ac633bc66dc100fe7fcfa54918af895bce012f182a068fc37c182e274, 0x1bdfd8b01401c70ad27f57396989129d710e1fb6ab976a459ca18682e26d7ff9],
[0x162a14c62f9a89b814b9d6a9c84dd678f4f6fb3f9054d373c832d824261a35ea, 0x2d193e0f76de586b2af6f79e3127feeaac0a1fc71e2cf0c0f79824667b5b6bec, 0x044ca3cc4a85d73b81696ef1104e674f4feff82984990ff85d0bf58dc8a4aa94],
[0x1cbaf2b371dac6a81d0453416d3e235cb8d9e2d4f314f46f6198785f0cd6b9af, 0x1d5b2777692c205b0e6c49d061b6b5f4293c4ab038fdbbdc343e07610f3fede5, 0x2e9bdbba3dd34bffaa30535bdd749a7e06a9adb0c1e6f962f60e971b8d73b04f],
[0x2de11886b18011ca8bd5bae36969299fde40fbe26d047b05035a13661f22418b, 0x2e07de1780b8a70d0d5b4a3f1841dcd82ab9395c449be947bc998884ba96a721, 0x0f69f1854d20ca0cbbdb63dbd52dad16250440a99d6b8af3825e4c2bb74925ca],
[0x2eb1b25417fe17670d135dc639fb09a46ce5113507f96de9816c059422dc705e, 0x115cd0a0643cfb988c24cb44c3fab48aff36c661d26cc42db8b1bdf4953bd82c, 0x26ca293f7b2c462d066d7378b999868bbb57ddf14e0f958ade801612311d04cd],
[0x17bf1b93c4c7e01a2a830aa162412cd90f160bf9f71e967ff5209d14b24820ca, 0x35b41a7ac4f3c571a24f8456369c85dfe03c0354bd8cfd3805c86f2e7dc293c5, 0x3b1480080523c439435927994849bea964e14d3beb2dddde72ac156af435d09e],
[0x2cc6810031dc1b0d4950856dc907d57508e286442a2d3eb2271618d874b14c6d, 0x25bdbbeda1bde8c1059618e2afd2ef999e517aa93b78341d91f318c09f0cb566, 0x392a4a8758e06ee8b95f33c25dde8ac02a5ed0a27b61926cc6313487073f7f7b],
[0x272a55878a08442b9aa6111f4de009485e6a6fd15db89365e7bbcef02eb5866c, 0x2d5b308b0cf02cdfefa13c4e60e26239a6ebba011694dd129b925b3c5b21e0e2, 0x16549fc6af2f3b72dd5d293d72e2e5f244dff42f18b46c56ef38c57c311673ac],
[0x1b10bb7a82afce39fa69c3a2ad52f76d76398265344203119b7126d9b46860df, 0x0f1e7505ebd91d2fc79c2df7dc98a3bed1b36968ba0405c090d27f6a00b7dfc8, 0x2f313faf0d3f6187537a7497a3b43f46797fd6e3f18eb1caff457756b819bb20],
[0x3a5cbb6de450b481fa3ca61c0ed15bc55cad11ebf0f7ceb8f0bc3e732ecb26f6, 0x3dab54bc9bef688dd92086e253b439d651baa6e20f892b62865527cbca915982, 0x06dbfb42b979884de280d31670123f744c24b33b410fefd4368045acf2b71ae3],
[0x068d6b4608aae810c6f039ea1973a63eb8d2de72e3d2c9eca7fc32d22f18b9d3, 0x366ebfafa3ad381c0ee258c9b8fdfccdb868a7d7e1f1f69a2b5dfcc5572555df, 0x39678f65512f1ee404db3024f41d3f567ef66d89d044d022e6bc229e95bc76b1],
[0x21668f016a8063c0d58b7750a3bc2fe1cf82c25f99dc01a4e534c88fe53d85fe, 0x39d00994a8a5046a1bc749363e98a768e34dea56439fe1954bef429bc5331608, 0x1f9dbdc3f84312636b203bbe12fb3425b163d41605d39f99770c956f60d881b3],
[0x027745a9cddfad95e5f17b9e0ee0cab6be0bc829fe5e66c69794a9f7c336eab2, 0x1cec0803c504b635788d695c61e932122fa43fe20a45c78d52025657abd8aee0, 0x123523d75e9fabc172077448ef87cc6eed5082c8dbf31365d3872a9559a03a73],
[0x1723d1452c9cf02df419b848e5d694bf27feba35975ee7e5001779e3a1d357f4, 0x1739d180a16010bdfcc0573d7e61369421c3f776f572836d9dab1ee4dcf96622, 0x2d4e6354da9cc554acce32391794b627fafa96fbeb0ab89370290452042d048d],
[0x153ee6142e535e334a869553c9d007f88f3bd43f99260621670bcf6f8b485dcd, 0x0c45bfd3a69aaa65635ef7e7a430b486968ad4424af83700d258d2e2b7782172, 0x0adfd53b256a6957f2d56aec831446006897ac0a8ffa5ff10e5633d251f73307],
[0x315d2ac8ebdbac3c8cd1726b7cbab8ee3f87b28f1c1be4bdac9d36a8b7516d63, 0x1b8472712d02eef4cfaec23d2b16883fc9bb60d1f6959879299ce44ea423d8e1, 0x3c1cd07efda6ff24bd0b70fa2255eb6f367d2c54e36928c9c4a5404198adf70c],
[0x136052d26bb3d373687f4e51b2e1dcd34a16073f738f7e0cbbe523aef9ab107a, 0x16c96beef6a0a848c1bdd859a1232a1d7b3cfbb873032681676c36c24ef967dd, 0x284b38c57ff65c262ab7fed8f499a9fb012387bab4f1662d067eec7f2d6340c4],
[0x0c5993d175e81f6639e242198897d17cfc06772c1c0411a6af1dff204c922f86, 0x03bf7a3f7bd043dafcda655d1ba9c8f9f24887ad48e17759bbf53f67b1f87b15, 0x3188fe4ee9f9fafbb0cf999567f00e734c8f9cbe69f0e8279b5cd09e36d8be62],
[0x171f528ccf6584375a39768c480d61e13af5bf77c1c42652afea99a2ec6c595a, 0x12f4175c4ab45afc196e41859b35ef88812c3286ee7000675a0563b9b8e9f1d5, 0x3a509e155cb7ebfd8f8fdcf800a9ac697e23e1aabe96cfab0e74d4d369118b79],
[0x10f2a685df4a27c81a89920e2504c3b3984bc8f2e4c1b69e98712c65678cfd30, 0x09e5f49790c8a0e21d8d93d54ab91a0e54573c9333c56321e8a16728cc9d4918, 0x352d69bed80ee3e52bf35705d9f84a3442d17ed6ee0fab7e609a740347cf5fea],
[0x058ee73ba9f3f293491562faf2b190d3c634debd281b76a63a758af6fa84e0e8, 0x232f99cc911eddd9cd0f1fc55b1a3250092cb92119bc76be621a132510a43904, 0x201beed7b8f3ab8186c22c6c5d4869f0f9efd52ca6bc2961c3b97c1e301bc213],
[0x1376dce6580030c6a1c9291d58602f5129388842744a1210bf6b3431ba94e9bc, 0x1793199e6fd6ba342b3356c38238f761072ba8b02d92e7226454843c5486d7b3, 0x22de7a7488dcc7359fee9c20c87a67df3c66160dc62aacac06a3f1d3b433311b],
[0x3514d5e9066bb160df8ff37fe2d8edf8dbe0b77fae77e1d030d6e3fd516b47a8, 0x30cd3006931ad636f919a00dabbf5fa5ff453d6f900f144a19377427137a81c7, 0x253d1a5c5293412741f81a5cf613c8df8f9e4b2cae2ebb515b6a74220692b506],
[0x035b461c02d79d19a35e9613e7f5fe92851b3a59c990fafc73f666cb86a48e8e, 0x23a9928079d175bd5bc00eedd56b93e092b1283c2d5fccde7cfbf86a3aa04780, 0x13a7785ae134ea92f1594a0763c611abb5e2ea3436eef957f1e4ccd73fa00a82],
[0x39fce308b7d43c574962ae3c0da17e313889c57863446d88bbf04f5252de4279, 0x1aae18833f8e1d3ac0fdf01662f60d22bef00a08c6ed38d23b57e34489b53fad, 0x1a761ce82400af018b2e80c064fd83ed27c1b3fd8f85d8a855513e033398513f],
[0x275a03e45adda7c316dd1a87ca22e1ccdcf6af2830a502875244ca749b73e481, 0x2e5a10f08b5ab8bbeb08e47e5feabcf807e561453fc5648b58a253cfb6a95786, 0x1459cb8587208473b84e9c333b2932f1c141a5b6d594bec4e033d82cefe78ce3],
[0x193ae5921d78b5de7b92ce810e14a40052f9332fbffcfbbd5cec7e7b338fbe1b, 0x3097898a5d0011a489111fb2c4660281374384f4a072820560224be67248e82c, 0x378d97bf8c864ae7571782fd96ce54b41979b2d1c465b4d9549980de862930f5],
[0x2eb04ea7c01d97ec88136287ce376b08dbc7f5cb4609342137ea32a971d17884, 0x36425347ea03f6412302a1c22e49baec861cbda476804e6cead3726f1af2e7b0, 0x26b72df47408ad42cc996cd85c98a1d83f5b5ca5a19a9701ecd627e59590d09e],
[0x130180e44e2924db1f05636c610b89aade01212ee4588f8959bece31f0a31e95, 0x219e97737d3979ba73275acaed5f579cdf7793cc89e5b52f9ea8e7bc79263550, 0x3cdb93598a5ca5283461363f81c489a23b0672dd7d42cbb49c12635df251d153],
[0x0e59e6f332d7ed3720724b927a0ca81c4ad0447045a7c5aa2861ce16f219d5a9, 0x1b064342d51a42753d7369467222697a172cc07b9d33fbf943b0a3fcff2036bd, 0x30b82a998cbd8e8a2f363c55b2882e0b78fa9fb9171221b73eb310228a0e5f6c],
[0x23e4ab37183acba463df7a76e858a4aa8ad71ea715be0573e46f6d4298740107, 0x2795d5c5fa4280225d33094e0beda75bacfe14640de044f2fca995e2b59914a1, 0x3001ca401e89601cd765f26dd03f4c45a6687c3df16c8fe4c26d909dee8b53c0],
[0x0072e45cc676b08ef7bf86e89280827fe84b5bebae4e501de7fea6bdf3471380, 0x13de705484874bb5e2abe4c518ce599eb64829e2d40e41bdd0c54ddeb26b86c0, 0x0408a9fcf9d61abf315950f1211defe882bb18e5af1b05bb38915b432a9959a5],
[0x2780b9e75b55676ebb4e4a1400ccd2c4ae4d23b0b41be9a834070cbee26886a0, 0x3a570d4d7c4e7ac3f80333ec85634ac9dc4d8fbefe24405a9405592098b4056f, 0x0c13cca7cb1f9d2cf347c247fcf09294e2cc1507bebdcc6278d2b247899520b4],
[0x14f59baa03cd0ca4d2614a197c6b794b0b50bb2eb82df74d2e8c88f7707470e0, 0x307defee925dfb436f546e1704c39c60a51d54ede66167f5be52476e0a16f3be, 0x1960cd511a91e0607a07e7674b5a2621661106836adfe5e7380b67d80473dce3],
[0x2301ef9c63ea84c5ca2ad0fb56672500b8ee335d88284cbe15aaf1f7712589dd, 0x029a5a47da79a488d10f4cd52be97f6bc86182d1b4246b585e68478c4d6027a9, 0x32d7b16a7f11cc962360d17d890e55cbf97fe46b6a9254282cc4f962eaae2260],
[0x26703e48c03b81ca18e857a98d498cf7a5f2404cd7b35eb0c0cab915d5363d9f, 0x048682a35b3265bc88ac8d25a24603f1f44388bd6b89221ef691123ae112b928, 0x06b1390441fa7030d72cddc6cf06b50791d6e1715164775e3ab7defcb8d803e2],
[0x31aa0eeb868c626d1689426dce05fcd843b360f6386a86d7bcd795414a6e2e86, 0x239464f75bf7b6af057abad3764c104b90efd8f41b2078b2ed77f5d576b99cc3, 0x0a64d4c04fd426bda45e19ed813a54aba5cc47c59654b2a7b2cb487307c1cecf],
[0x21fbbdbb73670734576a4ad259860fb1777c7a921a062e9d1f7315322f658735, 0x31b86f3cf01705d4d9371ca2eb95acf35b86d29463d31564674324003fc52146, 0x2bfde53354377c9105ef1736d09056f613541d65157ee1ce7045f48aa4eb4f6f],
[0x1233ca936ec24671d558f36e65f8eca7f4d5239c11d0eafa5a13a58d20011e2f, 0x27d452a43ac7dea2c437846d8e0b2b30878058d0234a576f6e70af0a7a924b3a, 0x2699dba82184e413e816ea8da493e0fa6a30641a1c3d87b2a02576b94392f980],
[0x36c722f0efcc8803c3988baee42e4b10f18584664f8cab49608c6f7a61b56e55, 0x02b3ff48861e339b08b0f2ec89ccaa3785c38899a7b5a8336e49ac170dbb7fcd, 0x0b70d061d58d8a7f60162f4427bc657b6fc3ff4c49eb59ada8c5ae03ad98e405],
[0x3fc2a13f127f96a4f8753adeb9d7cee2ad3de8be46ed96932e06cc4af33b0a06, 0x0c41a6e48dd23a511bd63434ac8c419f00cb3d621e171d80c12080ac117ee15f, 0x2de8072a6bd86884ed4476537169084e72aaad7e4e75339d9685213e9692f5e1],
[0x03557a8f7b38a17f9d3496a3d9fe05ecb81cf735cc9c39c00ad01184567b027c, 0x0b5f59552f498735ee976d34282f1a37060f43363d818e5445bcb5ac00826abc, 0x0e2923a5fee7b878fedbb18570dc7300f5d646e57507e5482f2909e17e22b0df],
[0x1d785005a7a00592c787be97020a7fddcf1cb37c3b032af6f71eed73f15b3326, 0x1ad772c273d9c6df0ba5fedcb8f25bd2a590b88a3b0602940acfbfb223f8f00d, 0x027bd64785fcbd2aa78f3275c278234b810510eb61f0672dc1ce13d60f2f5031],
[0x20800f441b4a0526ce6f8ffea1031b6de224313469457b8e8337f5e07923a853, 0x3d5ad61d7b65f9386eea2cd49f4312b436cdc8eed662ad37a33d7bed89a4408a, 0x13338bc351fc46dd02c5f91be4dd8e3d1df96cc03ea4b26d3bbbae94cc195284],
[0x25e52be507c92760b87db1e2af3ea923646c49f9b46cbf19c5271c297852819e, 0x1c492d64c157aaa471096d8b1b983c98a34c83a3485c6b2d5c380ab701b52ea9, 0x0c5b801579992718f4e6c5e7a573f592d43487bc288df682a20c0b3da0da4ca3],
[0x1090b1b4d2bebe7a68695c0cd7cbf43d584e9e62a7f9554e7ea33c93e40833cf, 0x33e38018a801387a68f5ce5cbed19cad1b218e35ecf2328ee383e1ec3baa8d69, 0x1654af18772b2da5eef8d83d0e876bac5f4a02d28729e3aeb76b0b3d787ee953],
[0x1678be3cc9c6799344742de88c5ab0d5bb0893870367ec6cef7ce6a013265477, 0x3780bd1e01f34c227ff9c6be546e928adaf1818355b13b4faf5d47893348f766, 0x1e83d6315c9f125b0786018e7cb772675d11e69aa6c0b98ca12380320d7cc1de],
[0x354afd0a2f9d0b26160b41552f2931c8c486894d76e0c33b1799603e855ce731, 0x00cd6d29f166eadc2d8affa62905c5a560b00dbe1faced078b997ee06be1bff3, 0x1d6219352768e3aedbe0e3d7cdbc66efc60d01973f18305708d0641917082f2c],
[0x146336e25db5181de48d2370d7d1a142afe3ca1db8d4f529fa08dd9806387577, 0x0005d8e085fd72ee997a21163e2e43df022e54b49c13d907a901d3ce84de0ad4, 0x364e97c7a38932270dd5e61c8a4e86426f8ebc1d2296021a1c36f31341964484],
[0x01189910671bc16b561c6fff15346878fa97ec80ad307a52d7a00c03d2e0baaa, 0x162a7c80f4d2d12e5229dfaa01231a454c0f7e001df490aa63fd8ac57a95ca8c, 0x2a0d6c09576666bb2604e4afb09f8603caff31b4fda3212432e69efb22f40b96],
[0x0978e5c51e1e5649e16a4d603d5a808ef444d10d63a74e2cc0a0180f8cbfc0d2, 0x1bdcee3aaca9cd25ebe19bbdce25101105087d903bdacfd103f4460ebc351b6e, 0x1862cccb70b5b885e49479140b1944fd0c947321e0075e3ff61964bf3ade7670],
[0x1f3e91d863c16922bc26cc883a1987e139ee99c1cc6e5ddac3267da6e94adc50, 0x1af47a48a6016a49ef5c08f8478f663afa661465c656ad990f85b4ac2c367406, 0x3c8ee901956e3d3f009d57338c6935051c3698b0a2e3da100eabcd87e7d01b15],
[0x1660a8cde7fec55368d0b024f591b520e10ce2b7069f4dbd8b94772189673476, 0x0f6d991929d5e4e71303936334dd11323963c2c1f5586e2f9d8d0f67fdaa79d5, 0x02b9cea1921cd9f6cc625eaaab52b4dc4e7fda770712f3437a433091e1ce2d3a],
[0x14a323b99b900331214f7c6784acb565d8caf468976f04723797b2d8376043b3, 0x190476b580cb9277ec01ea79642d5760718b7fbc7788af78347fef2c00f0953a, 0x090a3a9d869d2eefa42463d30b442b6f9660902b60087651ff4e7e6fb268dfd7],
[0x3877a955863675670dbe8fd2270a6795e365001304f9a11ef983387ea0456203, 0x2d894691240fe9535df39a2cc63ddc0a60118c53a218135239c0af0fe01f4a06, 0x21b9c18292bdbc597ef71780201661895914e855eeb44aa11aca9eaf9bba9850],
[0x2fe76be7cff723e2505a05f2a6ae834c272e1cc6c36a296833f509a74ad9d39b, 0x187aa448f391e3ca929981d7cfce253bd15bff840ddae8a50df9fa97277fa8b4, 0x0b7083ad751707bf007ab3aa3617f422663ccf7b2ffe4b5ef0c66af5ffc73736],
[0x030ddbb470493f163bc4ca9902c52acb1975b962f6cb8e0b2f9b20f1fbd49791, 0x3130fbaffb5aa82a950b0ab18d3546df8fb8ab9d60ea17b23a1c62ca8fbf2525, 0x337f544707c430f04f74d74bac2ee45715ce2ead2fcd051e43a876180dc382e0],
[0x349979919015394fac9d91b0930dac757d8e471a9fb95fef26de98a8736d1d11, 0x027cc4efe3fb35dd2305cd7a921ec5f13bf93da6fff31d95ccfcb61831d5c775, 0x037f9f2365954c5b61b71a3698682ad267f1c6b7314764afc3fa2629635d27de],
[0x1f697cac4d07feb710f1cc6df8b4bcd760414abe362d01c977c5b024848371ae, 0x267a750fe5d7cfbc26e6c851fbd572a63145c478063109d6786add244aa0ef29, 0x0c91feab4a43193a678c9996d9a472c8af285fa82ce4fae5180e2b4d3e756f65],
[0x1745569a0a3e30142186c3038ea05e697e3b83af4a4ba3ba79c47c573ac410f7, 0x29863d546e7e7c0deca5120778a56711fdff66c6f3b5ffe11e0388522696191f, 0x1148d6ab2bd00192bf06bae49ef853f6a79a03df833994c62f225e6366bfe390],
[0x02e0e121b0f3dfefe18b1499060da366f745f45d350d41d4f4f6331a8b265d15, 0x0d0aa46e76a6a278b89ef73a40a2b274690401736d44a653078ae6aa151054b7, 0x13943675b04aa986eee545f3fa6d3d08392dde710f1f06db9a4d532c7b6e0958],
[0x2901ec61942d34aad97a11d63088f5d9c9f2b3257530dafe961fc818dcbb66b5, 0x20204a2105d22e7ef431d54434a3e0cf22ffa2a2af9fa3e3fdf544b963d1fdc7, 0x3a8a628295121d5c5c1e3e9e27a571c3a004abe8e01528c41211b9e2190d6852],
])]
assert len(ROUND_CONSTANTS) == (R_F + R_P) * t
# MDS matrix generated by the reference implementation script, commit 659de89
# https://extgit.iaik.tugraz.at/krypto/hadeshash/-/blob/master/code/generate_parameters_grain.sage
#
# $ sage generate_parameters_grain.sage 1 0 255 3 8 58 0x40000000000000000000000000000000224698fc094cf91b992d30ed00000001
# $ sage generate_parameters_grain.sage 1 0 255 3 8 56 0x40000000000000000000000000000000224698fc094cf91b992d30ed00000001
MDS_MATRIX = [
[
Fp(0x2cebbe1217e122842b2b44a0ae977970cec9f15275e151dd5480ad1404165bb7),
Fp(0x3110b59ae4e814cf0aa4a254996d009a71a0a9a85c2faf79dc655cba595f6be2),
Fp(0x12e2f0714a5cca1df6113fb1e6f9d58fccbd6da8a74dd18a6a7edd65fbe71f3a)
Fp(0x0ab5e5b874a68de7b3d59fbdc8c9ead497d7a0ab23850b56323f2486d7e11b63),
Fp(0x31916628e58a5abb293f0f0d886c7954240d4a7cbf7357368eca5596e996ab5e),
Fp(0x07c045d5f5e9e5a6d803952bbb364fdfa0a3b71a5fb1573519d1cf25d8e8345d),
],
[
Fp(0x105843a552c0f9b98422eacaccb4e3cd1ef3c5b7712d8a4d60cfaae4ab4ac980),
Fp(0x3ce87897c427fcea40080459729c0a350956b6541965fc7e853ad5ef4fc3c705),
Fp(0x1d06d6ddc91585c68681544367a147943d473e48acfafc5a3185211502184691)
Fp(0x233162630ebf9ed7f8e24f66822c2d9f3a0a464048bd770ad049cdc8d085167c),
Fp(0x25cae2599892a8b0b36664548d60957d78f8365c85bbab07402270113e047a2e),
Fp(0x22f5b5e1e6081c9774938717989a19579aad3d8262efd83ff84d806f685f747a),
],
[
Fp(0x2e73a08701c0f7e906387e6a377030919e53df433c9b311dc9ced954a22540b2),
Fp(0x3f250fa921f576983424f185565fe5b4b21eb75a1f46501c1240f8d2a183d3d5),
Fp(0x2f37602cd4d8f52df318f9d0723be105989a59402f581c3eaa6315cf8d657550)
Fp(0x2e29dd59c64b1037f333aa91c383346421680eabc56bc15dfee7a9944f84dbe4),
Fp(0x1d1aab4ec1cd678892d15e7dceef1665cbeaf48b3a0624c3c771effa43263664),
Fp(0x3bf763086a18936451e0cbead65516b975872c39b59a31f615639415f6e85ef1),
]
]
def main():
# These are test vectors from https://github.com/daira/pasta-hadeshash/commit/cdab5252d0ec675780e9f8c3d09fdb7a0a71d3ff.
# These are test vectors from https://github.com/daira/pasta-hadeshash/commit/f7ca15dcf8568f1a4b2c4b7188815e80e9ab8975.
fixed_test_input = [
Fp(0x0000000000000000000000000000000000000000000000000000000000000000),
Fp(0x0000000000000000000000000000000000000000000000000000000000000001),
Fp(0x0000000000000000000000000000000000000000000000000000000000000002)
Fp(0x0000000000000000000000000000000000000000000000000000000000000002),
]
fixed_test_output = [
Fp(0x19a264dbf840aaeae2d33be07ee5db5c6ad21f3e05112d6e45860cdfc1224c90),
Fp(0x11b823d66e94c285813686b6df10cf9931cc06bfdf6bd5fd3dc3ed1c3434091e),
Fp(0x111104f41966d2ce68a635c3b4cbb608cbaa5caeabc596e3c5dc3d6d756ede28)
Fp(0x2a526acd0b64b45394efb364f966240ff7e69a71d0b642a0aeb1bc024aeca456),
Fp(0x13c5d1568b4aa43076ff7dae343d5512dcd42e7fbed9dafe012a3e9628e5b82a),
Fp(0x0a49c868c6976544256fcd597984561af7cfdfe1bda42c7b359029a1d34e9ddd),
]
assert perm(fixed_test_input) == fixed_test_output