diff --git a/crypto/BouncyCastle.csproj b/crypto/BouncyCastle.csproj
index 3a3dadd211..e445d728a1 100644
--- a/crypto/BouncyCastle.csproj
+++ b/crypto/BouncyCastle.csproj
@@ -665,6 +665,7 @@
+
diff --git a/crypto/src/crypto/engines/AnubisEngine.cs b/crypto/src/crypto/engines/AnubisEngine.cs
new file mode 100644
index 0000000000..1d91df10ed
--- /dev/null
+++ b/crypto/src/crypto/engines/AnubisEngine.cs
@@ -0,0 +1,1122 @@
+using System;
+
+using Org.BouncyCastle.Crypto.Parameters;
+using Org.BouncyCastle.Crypto.Utilities;
+using Org.BouncyCastle.Utilities;
+
+namespace Org.BouncyCastle.Crypto.Engines
+{
+ /**
+ * an implementation of Anubis, based on the documentation and reference
+ * implementation by Paulo S. L. M. Barreto, Vincent Rijmen.
+ */
+ public class AnubisEngine
+ : IBlockCipher
+ {
+ private static readonly uint[] T0_original =
+ {
+ 0xA753A6F5, 0xD3BB6BD0, 0xE6D1BF6E, 0x71E2D93B,
+ 0xD0BD67DA, 0xAC458ACF, 0x4D9A29B3, 0x79F2F90B,
+ 0x3A74E89C, 0xC98F038C, 0x913F7E41, 0xFCE5D732,
+ 0x1E3C7844, 0x478E018F, 0x54A84DE5, 0xBD67CEA9,
+ 0x8C050A0F, 0xA557AEF9, 0x7AF4F501, 0xFBEBCB20,
+ 0x63C69157, 0xB86DDAB7, 0xDDA753F4, 0xD4B577C2,
+ 0xE5D7B364, 0xB37BF68D, 0xC59733A4, 0xBE61C2A3,
+ 0xA94F9ED1, 0x880D1A17, 0x0C183028, 0xA259B2EB,
+ 0x3972E496, 0xDFA35BF8, 0x2952A4F6, 0xDAA94FE6,
+ 0x2B56ACFA, 0xA84D9AD7, 0xCB8B0B80, 0x4C982DB5,
+ 0x4B9631A7, 0x224488CC, 0xAA4992DB, 0x244890D8,
+ 0x4182199B, 0x70E0DD3D, 0xA651A2F3, 0xF9EFC32C,
+ 0x5AB475C1, 0xE2D9AF76, 0xB07DFA87, 0x366CD8B4,
+ 0x7DFAE913, 0xE4D5B762, 0x3366CCAA, 0xFFE3DB38,
+ 0x60C09D5D, 0x204080C0, 0x08102030, 0x8B0B161D,
+ 0x5EBC65D9, 0xAB4B96DD, 0x7FFEE11F, 0x78F0FD0D,
+ 0x7CF8ED15, 0x2C58B0E8, 0x57AE41EF, 0xD2B96FD6,
+ 0xDCA557F2, 0x6DDAA973, 0x7EFCE519, 0x0D1A342E,
+ 0x53A651F7, 0x94356A5F, 0xC39B2BB0, 0x2850A0F0,
+ 0x274E9CD2, 0x060C1814, 0x5FBE61DF, 0xAD478EC9,
+ 0x67CE814F, 0x5CB86DD5, 0x55AA49E3, 0x48903DAD,
+ 0x0E1C3824, 0x52A455F1, 0xEAC98F46, 0x42841591,
+ 0x5BB671C7, 0x5DBA69D3, 0x3060C0A0, 0x58B07DCD,
+ 0x51A259FB, 0x59B279CB, 0x3C78F088, 0x4E9C25B9,
+ 0x3870E090, 0x8A09121B, 0x72E4D531, 0x14285078,
+ 0xE7D3BB68, 0xC6913FAE, 0xDEA15FFE, 0x50A05DFD,
+ 0x8E010203, 0x9239724B, 0xD1BF63DC, 0x77EEC12F,
+ 0x933B764D, 0x458A0983, 0x9A29527B, 0xCE811F9E,
+ 0x2D5AB4EE, 0x03060C0A, 0x62C49551, 0xB671E293,
+ 0xB96FDEB1, 0xBF63C6A5, 0x96316253, 0x6BD6B167,
+ 0x3F7EFC82, 0x070E1C12, 0x1224486C, 0xAE4182C3,
+ 0x40801D9D, 0x3468D0B8, 0x468C0589, 0x3E7CF884,
+ 0xDBAB4BE0, 0xCF831B98, 0xECC59752, 0xCC851792,
+ 0xC19F23BC, 0xA15FBEE1, 0xC09D27BA, 0xD6B17FCE,
+ 0x1D3A744E, 0xF4F5F702, 0x61C2995B, 0x3B76EC9A,
+ 0x10204060, 0xD8AD47EA, 0x68D0BD6D, 0xA05DBAE7,
+ 0xB17FFE81, 0x0A14283C, 0x69D2B96B, 0x6CD8AD75,
+ 0x499239AB, 0xFAE9CF26, 0x76ECC529, 0xC49537A2,
+ 0x9E214263, 0x9B2B567D, 0x6EDCA579, 0x992F5E71,
+ 0xC2992FB6, 0xB773E695, 0x982D5A77, 0xBC65CAAF,
+ 0x8F030605, 0x85172E39, 0x1F3E7C42, 0xB475EA9F,
+ 0xF8EDC72A, 0x11224466, 0x2E5CB8E4, 0x00000000,
+ 0x254A94DE, 0x1C387048, 0x2A54A8FC, 0x3D7AF48E,
+ 0x050A141E, 0x4F9E21BF, 0x7BF6F107, 0xB279F28B,
+ 0x3264C8AC, 0x903D7A47, 0xAF4386C5, 0x19326456,
+ 0xA35BB6ED, 0xF7F3FB08, 0x73E6D137, 0x9D274E69,
+ 0x152A547E, 0x74E8CD25, 0xEEC19F5E, 0xCA890F86,
+ 0x9F234665, 0x0F1E3C22, 0x1B366C5A, 0x75EAC923,
+ 0x86112233, 0x84152A3F, 0x9C254A6F, 0x4A9435A1,
+ 0x97336655, 0x1A34685C, 0x65CA8943, 0xF6F1FF0E,
+ 0xEDC79354, 0x09122436, 0xBB6BD6BD, 0x264C98D4,
+ 0x831B362D, 0xEBCB8B40, 0x6FDEA17F, 0x811F3E21,
+ 0x04081018, 0x6AD4B561, 0x43861197, 0x01020406,
+ 0x172E5C72, 0xE1DFA37C, 0x87132635, 0xF5F7F304,
+ 0x8D070E09, 0xE3DBAB70, 0x23468CCA, 0x801D3A27,
+ 0x44880D85, 0x162C5874, 0x66CC8549, 0x214284C6,
+ 0xFEE1DF3E, 0xD5B773C4, 0x3162C4A6, 0xD9AF43EC,
+ 0x356AD4BE, 0x18306050, 0x0204080C, 0x64C88D45,
+ 0xF2F9EF16, 0xF1FFE31C, 0x56AC45E9, 0xCD871394,
+ 0x8219322B, 0xC88D078A, 0xBA69D2BB, 0xF0FDE71A,
+ 0xEFC39B58, 0xE9CF834C, 0xE8CD874A, 0xFDE7D334,
+ 0x890F1E11, 0xD7B37BC8, 0xC7933BA8, 0xB577EE99,
+ 0xA455AAFF, 0x2F5EBCE2, 0x95376E59, 0x13264C6A,
+ 0x0B162C3A, 0xF3FBEB10, 0xE0DDA77A, 0x376EDCB2
+ };
+
+ private static readonly uint[] T1_original =
+ {
+ 0x53A7F5A6, 0xBBD3D06B, 0xD1E66EBF, 0xE2713BD9,
+ 0xBDD0DA67, 0x45ACCF8A, 0x9A4DB329, 0xF2790BF9,
+ 0x743A9CE8, 0x8FC98C03, 0x3F91417E, 0xE5FC32D7,
+ 0x3C1E4478, 0x8E478F01, 0xA854E54D, 0x67BDA9CE,
+ 0x058C0F0A, 0x57A5F9AE, 0xF47A01F5, 0xEBFB20CB,
+ 0xC6635791, 0x6DB8B7DA, 0xA7DDF453, 0xB5D4C277,
+ 0xD7E564B3, 0x7BB38DF6, 0x97C5A433, 0x61BEA3C2,
+ 0x4FA9D19E, 0x0D88171A, 0x180C2830, 0x59A2EBB2,
+ 0x723996E4, 0xA3DFF85B, 0x5229F6A4, 0xA9DAE64F,
+ 0x562BFAAC, 0x4DA8D79A, 0x8BCB800B, 0x984CB52D,
+ 0x964BA731, 0x4422CC88, 0x49AADB92, 0x4824D890,
+ 0x82419B19, 0xE0703DDD, 0x51A6F3A2, 0xEFF92CC3,
+ 0xB45AC175, 0xD9E276AF, 0x7DB087FA, 0x6C36B4D8,
+ 0xFA7D13E9, 0xD5E462B7, 0x6633AACC, 0xE3FF38DB,
+ 0xC0605D9D, 0x4020C080, 0x10083020, 0x0B8B1D16,
+ 0xBC5ED965, 0x4BABDD96, 0xFE7F1FE1, 0xF0780DFD,
+ 0xF87C15ED, 0x582CE8B0, 0xAE57EF41, 0xB9D2D66F,
+ 0xA5DCF257, 0xDA6D73A9, 0xFC7E19E5, 0x1A0D2E34,
+ 0xA653F751, 0x35945F6A, 0x9BC3B02B, 0x5028F0A0,
+ 0x4E27D29C, 0x0C061418, 0xBE5FDF61, 0x47ADC98E,
+ 0xCE674F81, 0xB85CD56D, 0xAA55E349, 0x9048AD3D,
+ 0x1C0E2438, 0xA452F155, 0xC9EA468F, 0x84429115,
+ 0xB65BC771, 0xBA5DD369, 0x6030A0C0, 0xB058CD7D,
+ 0xA251FB59, 0xB259CB79, 0x783C88F0, 0x9C4EB925,
+ 0x703890E0, 0x098A1B12, 0xE47231D5, 0x28147850,
+ 0xD3E768BB, 0x91C6AE3F, 0xA1DEFE5F, 0xA050FD5D,
+ 0x018E0302, 0x39924B72, 0xBFD1DC63, 0xEE772FC1,
+ 0x3B934D76, 0x8A458309, 0x299A7B52, 0x81CE9E1F,
+ 0x5A2DEEB4, 0x06030A0C, 0xC4625195, 0x71B693E2,
+ 0x6FB9B1DE, 0x63BFA5C6, 0x31965362, 0xD66B67B1,
+ 0x7E3F82FC, 0x0E07121C, 0x24126C48, 0x41AEC382,
+ 0x80409D1D, 0x6834B8D0, 0x8C468905, 0x7C3E84F8,
+ 0xABDBE04B, 0x83CF981B, 0xC5EC5297, 0x85CC9217,
+ 0x9FC1BC23, 0x5FA1E1BE, 0x9DC0BA27, 0xB1D6CE7F,
+ 0x3A1D4E74, 0xF5F402F7, 0xC2615B99, 0x763B9AEC,
+ 0x20106040, 0xADD8EA47, 0xD0686DBD, 0x5DA0E7BA,
+ 0x7FB181FE, 0x140A3C28, 0xD2696BB9, 0xD86C75AD,
+ 0x9249AB39, 0xE9FA26CF, 0xEC7629C5, 0x95C4A237,
+ 0x219E6342, 0x2B9B7D56, 0xDC6E79A5, 0x2F99715E,
+ 0x99C2B62F, 0x73B795E6, 0x2D98775A, 0x65BCAFCA,
+ 0x038F0506, 0x1785392E, 0x3E1F427C, 0x75B49FEA,
+ 0xEDF82AC7, 0x22116644, 0x5C2EE4B8, 0x00000000,
+ 0x4A25DE94, 0x381C4870, 0x542AFCA8, 0x7A3D8EF4,
+ 0x0A051E14, 0x9E4FBF21, 0xF67B07F1, 0x79B28BF2,
+ 0x6432ACC8, 0x3D90477A, 0x43AFC586, 0x32195664,
+ 0x5BA3EDB6, 0xF3F708FB, 0xE67337D1, 0x279D694E,
+ 0x2A157E54, 0xE87425CD, 0xC1EE5E9F, 0x89CA860F,
+ 0x239F6546, 0x1E0F223C, 0x361B5A6C, 0xEA7523C9,
+ 0x11863322, 0x15843F2A, 0x259C6F4A, 0x944AA135,
+ 0x33975566, 0x341A5C68, 0xCA654389, 0xF1F60EFF,
+ 0xC7ED5493, 0x12093624, 0x6BBBBDD6, 0x4C26D498,
+ 0x1B832D36, 0xCBEB408B, 0xDE6F7FA1, 0x1F81213E,
+ 0x08041810, 0xD46A61B5, 0x86439711, 0x02010604,
+ 0x2E17725C, 0xDFE17CA3, 0x13873526, 0xF7F504F3,
+ 0x078D090E, 0xDBE370AB, 0x4623CA8C, 0x1D80273A,
+ 0x8844850D, 0x2C167458, 0xCC664985, 0x4221C684,
+ 0xE1FE3EDF, 0xB7D5C473, 0x6231A6C4, 0xAFD9EC43,
+ 0x6A35BED4, 0x30185060, 0x04020C08, 0xC864458D,
+ 0xF9F216EF, 0xFFF11CE3, 0xAC56E945, 0x87CD9413,
+ 0x19822B32, 0x8DC88A07, 0x69BABBD2, 0xFDF01AE7,
+ 0xC3EF589B, 0xCFE94C83, 0xCDE84A87, 0xE7FD34D3,
+ 0x0F89111E, 0xB3D7C87B, 0x93C7A83B, 0x77B599EE,
+ 0x55A4FFAA, 0x5E2FE2BC, 0x3795596E, 0x26136A4C,
+ 0x160B3A2C, 0xFBF310EB, 0xDDE07AA7, 0x6E37B2DC
+ };
+
+ private static readonly uint[] T2_original =
+ {
+ 0xA6F5A753, 0x6BD0D3BB, 0xBF6EE6D1, 0xD93B71E2,
+ 0x67DAD0BD, 0x8ACFAC45, 0x29B34D9A, 0xF90B79F2,
+ 0xE89C3A74, 0x038CC98F, 0x7E41913F, 0xD732FCE5,
+ 0x78441E3C, 0x018F478E, 0x4DE554A8, 0xCEA9BD67,
+ 0x0A0F8C05, 0xAEF9A557, 0xF5017AF4, 0xCB20FBEB,
+ 0x915763C6, 0xDAB7B86D, 0x53F4DDA7, 0x77C2D4B5,
+ 0xB364E5D7, 0xF68DB37B, 0x33A4C597, 0xC2A3BE61,
+ 0x9ED1A94F, 0x1A17880D, 0x30280C18, 0xB2EBA259,
+ 0xE4963972, 0x5BF8DFA3, 0xA4F62952, 0x4FE6DAA9,
+ 0xACFA2B56, 0x9AD7A84D, 0x0B80CB8B, 0x2DB54C98,
+ 0x31A74B96, 0x88CC2244, 0x92DBAA49, 0x90D82448,
+ 0x199B4182, 0xDD3D70E0, 0xA2F3A651, 0xC32CF9EF,
+ 0x75C15AB4, 0xAF76E2D9, 0xFA87B07D, 0xD8B4366C,
+ 0xE9137DFA, 0xB762E4D5, 0xCCAA3366, 0xDB38FFE3,
+ 0x9D5D60C0, 0x80C02040, 0x20300810, 0x161D8B0B,
+ 0x65D95EBC, 0x96DDAB4B, 0xE11F7FFE, 0xFD0D78F0,
+ 0xED157CF8, 0xB0E82C58, 0x41EF57AE, 0x6FD6D2B9,
+ 0x57F2DCA5, 0xA9736DDA, 0xE5197EFC, 0x342E0D1A,
+ 0x51F753A6, 0x6A5F9435, 0x2BB0C39B, 0xA0F02850,
+ 0x9CD2274E, 0x1814060C, 0x61DF5FBE, 0x8EC9AD47,
+ 0x814F67CE, 0x6DD55CB8, 0x49E355AA, 0x3DAD4890,
+ 0x38240E1C, 0x55F152A4, 0x8F46EAC9, 0x15914284,
+ 0x71C75BB6, 0x69D35DBA, 0xC0A03060, 0x7DCD58B0,
+ 0x59FB51A2, 0x79CB59B2, 0xF0883C78, 0x25B94E9C,
+ 0xE0903870, 0x121B8A09, 0xD53172E4, 0x50781428,
+ 0xBB68E7D3, 0x3FAEC691, 0x5FFEDEA1, 0x5DFD50A0,
+ 0x02038E01, 0x724B9239, 0x63DCD1BF, 0xC12F77EE,
+ 0x764D933B, 0x0983458A, 0x527B9A29, 0x1F9ECE81,
+ 0xB4EE2D5A, 0x0C0A0306, 0x955162C4, 0xE293B671,
+ 0xDEB1B96F, 0xC6A5BF63, 0x62539631, 0xB1676BD6,
+ 0xFC823F7E, 0x1C12070E, 0x486C1224, 0x82C3AE41,
+ 0x1D9D4080, 0xD0B83468, 0x0589468C, 0xF8843E7C,
+ 0x4BE0DBAB, 0x1B98CF83, 0x9752ECC5, 0x1792CC85,
+ 0x23BCC19F, 0xBEE1A15F, 0x27BAC09D, 0x7FCED6B1,
+ 0x744E1D3A, 0xF702F4F5, 0x995B61C2, 0xEC9A3B76,
+ 0x40601020, 0x47EAD8AD, 0xBD6D68D0, 0xBAE7A05D,
+ 0xFE81B17F, 0x283C0A14, 0xB96B69D2, 0xAD756CD8,
+ 0x39AB4992, 0xCF26FAE9, 0xC52976EC, 0x37A2C495,
+ 0x42639E21, 0x567D9B2B, 0xA5796EDC, 0x5E71992F,
+ 0x2FB6C299, 0xE695B773, 0x5A77982D, 0xCAAFBC65,
+ 0x06058F03, 0x2E398517, 0x7C421F3E, 0xEA9FB475,
+ 0xC72AF8ED, 0x44661122, 0xB8E42E5C, 0x00000000,
+ 0x94DE254A, 0x70481C38, 0xA8FC2A54, 0xF48E3D7A,
+ 0x141E050A, 0x21BF4F9E, 0xF1077BF6, 0xF28BB279,
+ 0xC8AC3264, 0x7A47903D, 0x86C5AF43, 0x64561932,
+ 0xB6EDA35B, 0xFB08F7F3, 0xD13773E6, 0x4E699D27,
+ 0x547E152A, 0xCD2574E8, 0x9F5EEEC1, 0x0F86CA89,
+ 0x46659F23, 0x3C220F1E, 0x6C5A1B36, 0xC92375EA,
+ 0x22338611, 0x2A3F8415, 0x4A6F9C25, 0x35A14A94,
+ 0x66559733, 0x685C1A34, 0x894365CA, 0xFF0EF6F1,
+ 0x9354EDC7, 0x24360912, 0xD6BDBB6B, 0x98D4264C,
+ 0x362D831B, 0x8B40EBCB, 0xA17F6FDE, 0x3E21811F,
+ 0x10180408, 0xB5616AD4, 0x11974386, 0x04060102,
+ 0x5C72172E, 0xA37CE1DF, 0x26358713, 0xF304F5F7,
+ 0x0E098D07, 0xAB70E3DB, 0x8CCA2346, 0x3A27801D,
+ 0x0D854488, 0x5874162C, 0x854966CC, 0x84C62142,
+ 0xDF3EFEE1, 0x73C4D5B7, 0xC4A63162, 0x43ECD9AF,
+ 0xD4BE356A, 0x60501830, 0x080C0204, 0x8D4564C8,
+ 0xEF16F2F9, 0xE31CF1FF, 0x45E956AC, 0x1394CD87,
+ 0x322B8219, 0x078AC88D, 0xD2BBBA69, 0xE71AF0FD,
+ 0x9B58EFC3, 0x834CE9CF, 0x874AE8CD, 0xD334FDE7,
+ 0x1E11890F, 0x7BC8D7B3, 0x3BA8C793, 0xEE99B577,
+ 0xAAFFA455, 0xBCE22F5E, 0x6E599537, 0x4C6A1326,
+ 0x2C3A0B16, 0xEB10F3FB, 0xA77AE0DD, 0xDCB2376E
+ };
+
+ private static readonly uint[] T3_original =
+ {
+ 0xF5A653A7, 0xD06BBBD3, 0x6EBFD1E6, 0x3BD9E271,
+ 0xDA67BDD0, 0xCF8A45AC, 0xB3299A4D, 0x0BF9F279,
+ 0x9CE8743A, 0x8C038FC9, 0x417E3F91, 0x32D7E5FC,
+ 0x44783C1E, 0x8F018E47, 0xE54DA854, 0xA9CE67BD,
+ 0x0F0A058C, 0xF9AE57A5, 0x01F5F47A, 0x20CBEBFB,
+ 0x5791C663, 0xB7DA6DB8, 0xF453A7DD, 0xC277B5D4,
+ 0x64B3D7E5, 0x8DF67BB3, 0xA43397C5, 0xA3C261BE,
+ 0xD19E4FA9, 0x171A0D88, 0x2830180C, 0xEBB259A2,
+ 0x96E47239, 0xF85BA3DF, 0xF6A45229, 0xE64FA9DA,
+ 0xFAAC562B, 0xD79A4DA8, 0x800B8BCB, 0xB52D984C,
+ 0xA731964B, 0xCC884422, 0xDB9249AA, 0xD8904824,
+ 0x9B198241, 0x3DDDE070, 0xF3A251A6, 0x2CC3EFF9,
+ 0xC175B45A, 0x76AFD9E2, 0x87FA7DB0, 0xB4D86C36,
+ 0x13E9FA7D, 0x62B7D5E4, 0xAACC6633, 0x38DBE3FF,
+ 0x5D9DC060, 0xC0804020, 0x30201008, 0x1D160B8B,
+ 0xD965BC5E, 0xDD964BAB, 0x1FE1FE7F, 0x0DFDF078,
+ 0x15EDF87C, 0xE8B0582C, 0xEF41AE57, 0xD66FB9D2,
+ 0xF257A5DC, 0x73A9DA6D, 0x19E5FC7E, 0x2E341A0D,
+ 0xF751A653, 0x5F6A3594, 0xB02B9BC3, 0xF0A05028,
+ 0xD29C4E27, 0x14180C06, 0xDF61BE5F, 0xC98E47AD,
+ 0x4F81CE67, 0xD56DB85C, 0xE349AA55, 0xAD3D9048,
+ 0x24381C0E, 0xF155A452, 0x468FC9EA, 0x91158442,
+ 0xC771B65B, 0xD369BA5D, 0xA0C06030, 0xCD7DB058,
+ 0xFB59A251, 0xCB79B259, 0x88F0783C, 0xB9259C4E,
+ 0x90E07038, 0x1B12098A, 0x31D5E472, 0x78502814,
+ 0x68BBD3E7, 0xAE3F91C6, 0xFE5FA1DE, 0xFD5DA050,
+ 0x0302018E, 0x4B723992, 0xDC63BFD1, 0x2FC1EE77,
+ 0x4D763B93, 0x83098A45, 0x7B52299A, 0x9E1F81CE,
+ 0xEEB45A2D, 0x0A0C0603, 0x5195C462, 0x93E271B6,
+ 0xB1DE6FB9, 0xA5C663BF, 0x53623196, 0x67B1D66B,
+ 0x82FC7E3F, 0x121C0E07, 0x6C482412, 0xC38241AE,
+ 0x9D1D8040, 0xB8D06834, 0x89058C46, 0x84F87C3E,
+ 0xE04BABDB, 0x981B83CF, 0x5297C5EC, 0x921785CC,
+ 0xBC239FC1, 0xE1BE5FA1, 0xBA279DC0, 0xCE7FB1D6,
+ 0x4E743A1D, 0x02F7F5F4, 0x5B99C261, 0x9AEC763B,
+ 0x60402010, 0xEA47ADD8, 0x6DBDD068, 0xE7BA5DA0,
+ 0x81FE7FB1, 0x3C28140A, 0x6BB9D269, 0x75ADD86C,
+ 0xAB399249, 0x26CFE9FA, 0x29C5EC76, 0xA23795C4,
+ 0x6342219E, 0x7D562B9B, 0x79A5DC6E, 0x715E2F99,
+ 0xB62F99C2, 0x95E673B7, 0x775A2D98, 0xAFCA65BC,
+ 0x0506038F, 0x392E1785, 0x427C3E1F, 0x9FEA75B4,
+ 0x2AC7EDF8, 0x66442211, 0xE4B85C2E, 0x00000000,
+ 0xDE944A25, 0x4870381C, 0xFCA8542A, 0x8EF47A3D,
+ 0x1E140A05, 0xBF219E4F, 0x07F1F67B, 0x8BF279B2,
+ 0xACC86432, 0x477A3D90, 0xC58643AF, 0x56643219,
+ 0xEDB65BA3, 0x08FBF3F7, 0x37D1E673, 0x694E279D,
+ 0x7E542A15, 0x25CDE874, 0x5E9FC1EE, 0x860F89CA,
+ 0x6546239F, 0x223C1E0F, 0x5A6C361B, 0x23C9EA75,
+ 0x33221186, 0x3F2A1584, 0x6F4A259C, 0xA135944A,
+ 0x55663397, 0x5C68341A, 0x4389CA65, 0x0EFFF1F6,
+ 0x5493C7ED, 0x36241209, 0xBDD66BBB, 0xD4984C26,
+ 0x2D361B83, 0x408BCBEB, 0x7FA1DE6F, 0x213E1F81,
+ 0x18100804, 0x61B5D46A, 0x97118643, 0x06040201,
+ 0x725C2E17, 0x7CA3DFE1, 0x35261387, 0x04F3F7F5,
+ 0x090E078D, 0x70ABDBE3, 0xCA8C4623, 0x273A1D80,
+ 0x850D8844, 0x74582C16, 0x4985CC66, 0xC6844221,
+ 0x3EDFE1FE, 0xC473B7D5, 0xA6C46231, 0xEC43AFD9,
+ 0xBED46A35, 0x50603018, 0x0C080402, 0x458DC864,
+ 0x16EFF9F2, 0x1CE3FFF1, 0xE945AC56, 0x941387CD,
+ 0x2B321982, 0x8A078DC8, 0xBBD269BA, 0x1AE7FDF0,
+ 0x589BC3EF, 0x4C83CFE9, 0x4A87CDE8, 0x34D3E7FD,
+ 0x111E0F89, 0xC87BB3D7, 0xA83B93C7, 0x99EE77B5,
+ 0xFFAA55A4, 0xE2BC5E2F, 0x596E3795, 0x6A4C2613,
+ 0x3A2C160B, 0x10EBFBF3, 0x7AA7DDE0, 0xB2DC6E37
+ };
+
+ private static readonly uint[] TK0_original =
+ {
+ 0xA7A7A7A7, 0xD3D3D3D3, 0xE6E6E6E6, 0x71717171,
+ 0xD0D0D0D0, 0xACACACAC, 0x4D4D4D4D, 0x79797979,
+ 0x3A3A3A3A, 0xC9C9C9C9, 0x91919191, 0xFCFCFCFC,
+ 0x1E1E1E1E, 0x47474747, 0x54545454, 0xBDBDBDBD,
+ 0x8C8C8C8C, 0xA5A5A5A5, 0x7A7A7A7A, 0xFBFBFBFB,
+ 0x63636363, 0xB8B8B8B8, 0xDDDDDDDD, 0xD4D4D4D4,
+ 0xE5E5E5E5, 0xB3B3B3B3, 0xC5C5C5C5, 0xBEBEBEBE,
+ 0xA9A9A9A9, 0x88888888, 0x0C0C0C0C, 0xA2A2A2A2,
+ 0x39393939, 0xDFDFDFDF, 0x29292929, 0xDADADADA,
+ 0x2B2B2B2B, 0xA8A8A8A8, 0xCBCBCBCB, 0x4C4C4C4C,
+ 0x4B4B4B4B, 0x22222222, 0xAAAAAAAA, 0x24242424,
+ 0x41414141, 0x70707070, 0xA6A6A6A6, 0xF9F9F9F9,
+ 0x5A5A5A5A, 0xE2E2E2E2, 0xB0B0B0B0, 0x36363636,
+ 0x7D7D7D7D, 0xE4E4E4E4, 0x33333333, 0xFFFFFFFF,
+ 0x60606060, 0x20202020, 0x08080808, 0x8B8B8B8B,
+ 0x5E5E5E5E, 0xABABABAB, 0x7F7F7F7F, 0x78787878,
+ 0x7C7C7C7C, 0x2C2C2C2C, 0x57575757, 0xD2D2D2D2,
+ 0xDCDCDCDC, 0x6D6D6D6D, 0x7E7E7E7E, 0x0D0D0D0D,
+ 0x53535353, 0x94949494, 0xC3C3C3C3, 0x28282828,
+ 0x27272727, 0x06060606, 0x5F5F5F5F, 0xADADADAD,
+ 0x67676767, 0x5C5C5C5C, 0x55555555, 0x48484848,
+ 0x0E0E0E0E, 0x52525252, 0xEAEAEAEA, 0x42424242,
+ 0x5B5B5B5B, 0x5D5D5D5D, 0x30303030, 0x58585858,
+ 0x51515151, 0x59595959, 0x3C3C3C3C, 0x4E4E4E4E,
+ 0x38383838, 0x8A8A8A8A, 0x72727272, 0x14141414,
+ 0xE7E7E7E7, 0xC6C6C6C6, 0xDEDEDEDE, 0x50505050,
+ 0x8E8E8E8E, 0x92929292, 0xD1D1D1D1, 0x77777777,
+ 0x93939393, 0x45454545, 0x9A9A9A9A, 0xCECECECE,
+ 0x2D2D2D2D, 0x03030303, 0x62626262, 0xB6B6B6B6,
+ 0xB9B9B9B9, 0xBFBFBFBF, 0x96969696, 0x6B6B6B6B,
+ 0x3F3F3F3F, 0x07070707, 0x12121212, 0xAEAEAEAE,
+ 0x40404040, 0x34343434, 0x46464646, 0x3E3E3E3E,
+ 0xDBDBDBDB, 0xCFCFCFCF, 0xECECECEC, 0xCCCCCCCC,
+ 0xC1C1C1C1, 0xA1A1A1A1, 0xC0C0C0C0, 0xD6D6D6D6,
+ 0x1D1D1D1D, 0xF4F4F4F4, 0x61616161, 0x3B3B3B3B,
+ 0x10101010, 0xD8D8D8D8, 0x68686868, 0xA0A0A0A0,
+ 0xB1B1B1B1, 0x0A0A0A0A, 0x69696969, 0x6C6C6C6C,
+ 0x49494949, 0xFAFAFAFA, 0x76767676, 0xC4C4C4C4,
+ 0x9E9E9E9E, 0x9B9B9B9B, 0x6E6E6E6E, 0x99999999,
+ 0xC2C2C2C2, 0xB7B7B7B7, 0x98989898, 0xBCBCBCBC,
+ 0x8F8F8F8F, 0x85858585, 0x1F1F1F1F, 0xB4B4B4B4,
+ 0xF8F8F8F8, 0x11111111, 0x2E2E2E2E, 0x00000000,
+ 0x25252525, 0x1C1C1C1C, 0x2A2A2A2A, 0x3D3D3D3D,
+ 0x05050505, 0x4F4F4F4F, 0x7B7B7B7B, 0xB2B2B2B2,
+ 0x32323232, 0x90909090, 0xAFAFAFAF, 0x19191919,
+ 0xA3A3A3A3, 0xF7F7F7F7, 0x73737373, 0x9D9D9D9D,
+ 0x15151515, 0x74747474, 0xEEEEEEEE, 0xCACACACA,
+ 0x9F9F9F9F, 0x0F0F0F0F, 0x1B1B1B1B, 0x75757575,
+ 0x86868686, 0x84848484, 0x9C9C9C9C, 0x4A4A4A4A,
+ 0x97979797, 0x1A1A1A1A, 0x65656565, 0xF6F6F6F6,
+ 0xEDEDEDED, 0x09090909, 0xBBBBBBBB, 0x26262626,
+ 0x83838383, 0xEBEBEBEB, 0x6F6F6F6F, 0x81818181,
+ 0x04040404, 0x6A6A6A6A, 0x43434343, 0x01010101,
+ 0x17171717, 0xE1E1E1E1, 0x87878787, 0xF5F5F5F5,
+ 0x8D8D8D8D, 0xE3E3E3E3, 0x23232323, 0x80808080,
+ 0x44444444, 0x16161616, 0x66666666, 0x21212121,
+ 0xFEFEFEFE, 0xD5D5D5D5, 0x31313131, 0xD9D9D9D9,
+ 0x35353535, 0x18181818, 0x02020202, 0x64646464,
+ 0xF2F2F2F2, 0xF1F1F1F1, 0x56565656, 0xCDCDCDCD,
+ 0x82828282, 0xC8C8C8C8, 0xBABABABA, 0xF0F0F0F0,
+ 0xEFEFEFEF, 0xE9E9E9E9, 0xE8E8E8E8, 0xFDFDFDFD,
+ 0x89898989, 0xD7D7D7D7, 0xC7C7C7C7, 0xB5B5B5B5,
+ 0xA4A4A4A4, 0x2F2F2F2F, 0x95959595, 0x13131313,
+ 0x0B0B0B0B, 0xF3F3F3F3, 0xE0E0E0E0, 0x37373737
+ };
+
+ private static readonly uint[] TK1_original =
+ {
+ 0x00000000, 0x01020608, 0x02040C10, 0x03060A18,
+ 0x04081820, 0x050A1E28, 0x060C1430, 0x070E1238,
+ 0x08103040, 0x09123648, 0x0A143C50, 0x0B163A58,
+ 0x0C182860, 0x0D1A2E68, 0x0E1C2470, 0x0F1E2278,
+ 0x10206080, 0x11226688, 0x12246C90, 0x13266A98,
+ 0x142878A0, 0x152A7EA8, 0x162C74B0, 0x172E72B8,
+ 0x183050C0, 0x193256C8, 0x1A345CD0, 0x1B365AD8,
+ 0x1C3848E0, 0x1D3A4EE8, 0x1E3C44F0, 0x1F3E42F8,
+ 0x2040C01D, 0x2142C615, 0x2244CC0D, 0x2346CA05,
+ 0x2448D83D, 0x254ADE35, 0x264CD42D, 0x274ED225,
+ 0x2850F05D, 0x2952F655, 0x2A54FC4D, 0x2B56FA45,
+ 0x2C58E87D, 0x2D5AEE75, 0x2E5CE46D, 0x2F5EE265,
+ 0x3060A09D, 0x3162A695, 0x3264AC8D, 0x3366AA85,
+ 0x3468B8BD, 0x356ABEB5, 0x366CB4AD, 0x376EB2A5,
+ 0x387090DD, 0x397296D5, 0x3A749CCD, 0x3B769AC5,
+ 0x3C7888FD, 0x3D7A8EF5, 0x3E7C84ED, 0x3F7E82E5,
+ 0x40809D3A, 0x41829B32, 0x4284912A, 0x43869722,
+ 0x4488851A, 0x458A8312, 0x468C890A, 0x478E8F02,
+ 0x4890AD7A, 0x4992AB72, 0x4A94A16A, 0x4B96A762,
+ 0x4C98B55A, 0x4D9AB352, 0x4E9CB94A, 0x4F9EBF42,
+ 0x50A0FDBA, 0x51A2FBB2, 0x52A4F1AA, 0x53A6F7A2,
+ 0x54A8E59A, 0x55AAE392, 0x56ACE98A, 0x57AEEF82,
+ 0x58B0CDFA, 0x59B2CBF2, 0x5AB4C1EA, 0x5BB6C7E2,
+ 0x5CB8D5DA, 0x5DBAD3D2, 0x5EBCD9CA, 0x5FBEDFC2,
+ 0x60C05D27, 0x61C25B2F, 0x62C45137, 0x63C6573F,
+ 0x64C84507, 0x65CA430F, 0x66CC4917, 0x67CE4F1F,
+ 0x68D06D67, 0x69D26B6F, 0x6AD46177, 0x6BD6677F,
+ 0x6CD87547, 0x6DDA734F, 0x6EDC7957, 0x6FDE7F5F,
+ 0x70E03DA7, 0x71E23BAF, 0x72E431B7, 0x73E637BF,
+ 0x74E82587, 0x75EA238F, 0x76EC2997, 0x77EE2F9F,
+ 0x78F00DE7, 0x79F20BEF, 0x7AF401F7, 0x7BF607FF,
+ 0x7CF815C7, 0x7DFA13CF, 0x7EFC19D7, 0x7FFE1FDF,
+ 0x801D2774, 0x811F217C, 0x82192B64, 0x831B2D6C,
+ 0x84153F54, 0x8517395C, 0x86113344, 0x8713354C,
+ 0x880D1734, 0x890F113C, 0x8A091B24, 0x8B0B1D2C,
+ 0x8C050F14, 0x8D07091C, 0x8E010304, 0x8F03050C,
+ 0x903D47F4, 0x913F41FC, 0x92394BE4, 0x933B4DEC,
+ 0x94355FD4, 0x953759DC, 0x963153C4, 0x973355CC,
+ 0x982D77B4, 0x992F71BC, 0x9A297BA4, 0x9B2B7DAC,
+ 0x9C256F94, 0x9D27699C, 0x9E216384, 0x9F23658C,
+ 0xA05DE769, 0xA15FE161, 0xA259EB79, 0xA35BED71,
+ 0xA455FF49, 0xA557F941, 0xA651F359, 0xA753F551,
+ 0xA84DD729, 0xA94FD121, 0xAA49DB39, 0xAB4BDD31,
+ 0xAC45CF09, 0xAD47C901, 0xAE41C319, 0xAF43C511,
+ 0xB07D87E9, 0xB17F81E1, 0xB2798BF9, 0xB37B8DF1,
+ 0xB4759FC9, 0xB57799C1, 0xB67193D9, 0xB77395D1,
+ 0xB86DB7A9, 0xB96FB1A1, 0xBA69BBB9, 0xBB6BBDB1,
+ 0xBC65AF89, 0xBD67A981, 0xBE61A399, 0xBF63A591,
+ 0xC09DBA4E, 0xC19FBC46, 0xC299B65E, 0xC39BB056,
+ 0xC495A26E, 0xC597A466, 0xC691AE7E, 0xC793A876,
+ 0xC88D8A0E, 0xC98F8C06, 0xCA89861E, 0xCB8B8016,
+ 0xCC85922E, 0xCD879426, 0xCE819E3E, 0xCF839836,
+ 0xD0BDDACE, 0xD1BFDCC6, 0xD2B9D6DE, 0xD3BBD0D6,
+ 0xD4B5C2EE, 0xD5B7C4E6, 0xD6B1CEFE, 0xD7B3C8F6,
+ 0xD8ADEA8E, 0xD9AFEC86, 0xDAA9E69E, 0xDBABE096,
+ 0xDCA5F2AE, 0xDDA7F4A6, 0xDEA1FEBE, 0xDFA3F8B6,
+ 0xE0DD7A53, 0xE1DF7C5B, 0xE2D97643, 0xE3DB704B,
+ 0xE4D56273, 0xE5D7647B, 0xE6D16E63, 0xE7D3686B,
+ 0xE8CD4A13, 0xE9CF4C1B, 0xEAC94603, 0xEBCB400B,
+ 0xECC55233, 0xEDC7543B, 0xEEC15E23, 0xEFC3582B,
+ 0xF0FD1AD3, 0xF1FF1CDB, 0xF2F916C3, 0xF3FB10CB,
+ 0xF4F502F3, 0xF5F704FB, 0xF6F10EE3, 0xF7F308EB,
+ 0xF8ED2A93, 0xF9EF2C9B, 0xFAE92683, 0xFBEB208B,
+ 0xFCE532B3, 0xFDE734BB, 0xFEE13EA3, 0xFFE338AB
+ };
+
+ private static readonly uint[] RCON_original =
+ {
+ 0xA7D3E671, 0xD0AC4D79, 0x3AC991FC, 0x1E4754BD,
+ 0x8CA57AFB, 0x63B8DDD4, 0xE5B3C5BE, 0xA9880CA2,
+ 0x39DF29DA, 0x2BA8CB4C, 0x4B22AA24, 0x4170A6F9,
+ 0x5AE2B036, 0x7DE433FF, 0x6020088B, 0x5EAB7F78,
+ 0x7C2C57D2, 0xDC6D7E0D, 0x5394C328
+ };
+
+ private static readonly uint[] T0_tweaked =
+ {
+ 0xBA69D2BB, 0x54A84DE5, 0x2F5EBCE2, 0x74E8CD25,
+ 0x53A651F7, 0xD3BB6BD0, 0xD2B96FD6, 0x4D9A29B3,
+ 0x50A05DFD, 0xAC458ACF, 0x8D070E09, 0xBF63C6A5,
+ 0x70E0DD3D, 0x52A455F1, 0x9A29527B, 0x4C982DB5,
+ 0xEAC98F46, 0xD5B773C4, 0x97336655, 0xD1BF63DC,
+ 0x3366CCAA, 0x51A259FB, 0x5BB671C7, 0xA651A2F3,
+ 0xDEA15FFE, 0x48903DAD, 0xA84D9AD7, 0x992F5E71,
+ 0xDBAB4BE0, 0x3264C8AC, 0xB773E695, 0xFCE5D732,
+ 0xE3DBAB70, 0x9E214263, 0x913F7E41, 0x9B2B567D,
+ 0xE2D9AF76, 0xBB6BD6BD, 0x4182199B, 0x6EDCA579,
+ 0xA557AEF9, 0xCB8B0B80, 0x6BD6B167, 0x95376E59,
+ 0xA15FBEE1, 0xF3FBEB10, 0xB17FFE81, 0x0204080C,
+ 0xCC851792, 0xC49537A2, 0x1D3A744E, 0x14285078,
+ 0xC39B2BB0, 0x63C69157, 0xDAA94FE6, 0x5DBA69D3,
+ 0x5FBE61DF, 0xDCA557F2, 0x7DFAE913, 0xCD871394,
+ 0x7FFEE11F, 0x5AB475C1, 0x6CD8AD75, 0x5CB86DD5,
+ 0xF7F3FB08, 0x264C98D4, 0xFFE3DB38, 0xEDC79354,
+ 0xE8CD874A, 0x9D274E69, 0x6FDEA17F, 0x8E010203,
+ 0x19326456, 0xA05DBAE7, 0xF0FDE71A, 0x890F1E11,
+ 0x0F1E3C22, 0x070E1C12, 0xAF4386C5, 0xFBEBCB20,
+ 0x08102030, 0x152A547E, 0x0D1A342E, 0x04081018,
+ 0x01020406, 0x64C88D45, 0xDFA35BF8, 0x76ECC529,
+ 0x79F2F90B, 0xDDA753F4, 0x3D7AF48E, 0x162C5874,
+ 0x3F7EFC82, 0x376EDCB2, 0x6DDAA973, 0x3870E090,
+ 0xB96FDEB1, 0x73E6D137, 0xE9CF834C, 0x356AD4BE,
+ 0x55AA49E3, 0x71E2D93B, 0x7BF6F107, 0x8C050A0F,
+ 0x72E4D531, 0x880D1A17, 0xF6F1FF0E, 0x2A54A8FC,
+ 0x3E7CF884, 0x5EBC65D9, 0x274E9CD2, 0x468C0589,
+ 0x0C183028, 0x65CA8943, 0x68D0BD6D, 0x61C2995B,
+ 0x03060C0A, 0xC19F23BC, 0x57AE41EF, 0xD6B17FCE,
+ 0xD9AF43EC, 0x58B07DCD, 0xD8AD47EA, 0x66CC8549,
+ 0xD7B37BC8, 0x3A74E89C, 0xC88D078A, 0x3C78F088,
+ 0xFAE9CF26, 0x96316253, 0xA753A6F5, 0x982D5A77,
+ 0xECC59752, 0xB86DDAB7, 0xC7933BA8, 0xAE4182C3,
+ 0x69D2B96B, 0x4B9631A7, 0xAB4B96DD, 0xA94F9ED1,
+ 0x67CE814F, 0x0A14283C, 0x478E018F, 0xF2F9EF16,
+ 0xB577EE99, 0x224488CC, 0xE5D7B364, 0xEEC19F5E,
+ 0xBE61C2A3, 0x2B56ACFA, 0x811F3E21, 0x1224486C,
+ 0x831B362D, 0x1B366C5A, 0x0E1C3824, 0x23468CCA,
+ 0xF5F7F304, 0x458A0983, 0x214284C6, 0xCE811F9E,
+ 0x499239AB, 0x2C58B0E8, 0xF9EFC32C, 0xE6D1BF6E,
+ 0xB671E293, 0x2850A0F0, 0x172E5C72, 0x8219322B,
+ 0x1A34685C, 0x8B0B161D, 0xFEE1DF3E, 0x8A09121B,
+ 0x09122436, 0xC98F038C, 0x87132635, 0x4E9C25B9,
+ 0xE1DFA37C, 0x2E5CB8E4, 0xE4D5B762, 0xE0DDA77A,
+ 0xEBCB8B40, 0x903D7A47, 0xA455AAFF, 0x1E3C7844,
+ 0x85172E39, 0x60C09D5D, 0x00000000, 0x254A94DE,
+ 0xF4F5F702, 0xF1FFE31C, 0x94356A5F, 0x0B162C3A,
+ 0xE7D3BB68, 0x75EAC923, 0xEFC39B58, 0x3468D0B8,
+ 0x3162C4A6, 0xD4B577C2, 0xD0BD67DA, 0x86112233,
+ 0x7EFCE519, 0xAD478EC9, 0xFDE7D334, 0x2952A4F6,
+ 0x3060C0A0, 0x3B76EC9A, 0x9F234665, 0xF8EDC72A,
+ 0xC6913FAE, 0x13264C6A, 0x060C1814, 0x050A141E,
+ 0xC59733A4, 0x11224466, 0x77EEC12F, 0x7CF8ED15,
+ 0x7AF4F501, 0x78F0FD0D, 0x366CD8B4, 0x1C387048,
+ 0x3972E496, 0x59B279CB, 0x18306050, 0x56AC45E9,
+ 0xB37BF68D, 0xB07DFA87, 0x244890D8, 0x204080C0,
+ 0xB279F28B, 0x9239724B, 0xA35BB6ED, 0xC09D27BA,
+ 0x44880D85, 0x62C49551, 0x10204060, 0xB475EA9F,
+ 0x84152A3F, 0x43861197, 0x933B764D, 0xC2992FB6,
+ 0x4A9435A1, 0xBD67CEA9, 0x8F030605, 0x2D5AB4EE,
+ 0xBC65CAAF, 0x9C254A6F, 0x6AD4B561, 0x40801D9D,
+ 0xCF831B98, 0xA259B2EB, 0x801D3A27, 0x4F9E21BF,
+ 0x1F3E7C42, 0xCA890F86, 0xAA4992DB, 0x42841591
+ };
+
+ private static readonly uint[] T1_tweaked =
+ {
+ 0x69BABBD2, 0xA854E54D, 0x5E2FE2BC, 0xE87425CD,
+ 0xA653F751, 0xBBD3D06B, 0xB9D2D66F, 0x9A4DB329,
+ 0xA050FD5D, 0x45ACCF8A, 0x078D090E, 0x63BFA5C6,
+ 0xE0703DDD, 0xA452F155, 0x299A7B52, 0x984CB52D,
+ 0xC9EA468F, 0xB7D5C473, 0x33975566, 0xBFD1DC63,
+ 0x6633AACC, 0xA251FB59, 0xB65BC771, 0x51A6F3A2,
+ 0xA1DEFE5F, 0x9048AD3D, 0x4DA8D79A, 0x2F99715E,
+ 0xABDBE04B, 0x6432ACC8, 0x73B795E6, 0xE5FC32D7,
+ 0xDBE370AB, 0x219E6342, 0x3F91417E, 0x2B9B7D56,
+ 0xD9E276AF, 0x6BBBBDD6, 0x82419B19, 0xDC6E79A5,
+ 0x57A5F9AE, 0x8BCB800B, 0xD66B67B1, 0x3795596E,
+ 0x5FA1E1BE, 0xFBF310EB, 0x7FB181FE, 0x04020C08,
+ 0x85CC9217, 0x95C4A237, 0x3A1D4E74, 0x28147850,
+ 0x9BC3B02B, 0xC6635791, 0xA9DAE64F, 0xBA5DD369,
+ 0xBE5FDF61, 0xA5DCF257, 0xFA7D13E9, 0x87CD9413,
+ 0xFE7F1FE1, 0xB45AC175, 0xD86C75AD, 0xB85CD56D,
+ 0xF3F708FB, 0x4C26D498, 0xE3FF38DB, 0xC7ED5493,
+ 0xCDE84A87, 0x279D694E, 0xDE6F7FA1, 0x018E0302,
+ 0x32195664, 0x5DA0E7BA, 0xFDF01AE7, 0x0F89111E,
+ 0x1E0F223C, 0x0E07121C, 0x43AFC586, 0xEBFB20CB,
+ 0x10083020, 0x2A157E54, 0x1A0D2E34, 0x08041810,
+ 0x02010604, 0xC864458D, 0xA3DFF85B, 0xEC7629C5,
+ 0xF2790BF9, 0xA7DDF453, 0x7A3D8EF4, 0x2C167458,
+ 0x7E3F82FC, 0x6E37B2DC, 0xDA6D73A9, 0x703890E0,
+ 0x6FB9B1DE, 0xE67337D1, 0xCFE94C83, 0x6A35BED4,
+ 0xAA55E349, 0xE2713BD9, 0xF67B07F1, 0x058C0F0A,
+ 0xE47231D5, 0x0D88171A, 0xF1F60EFF, 0x542AFCA8,
+ 0x7C3E84F8, 0xBC5ED965, 0x4E27D29C, 0x8C468905,
+ 0x180C2830, 0xCA654389, 0xD0686DBD, 0xC2615B99,
+ 0x06030A0C, 0x9FC1BC23, 0xAE57EF41, 0xB1D6CE7F,
+ 0xAFD9EC43, 0xB058CD7D, 0xADD8EA47, 0xCC664985,
+ 0xB3D7C87B, 0x743A9CE8, 0x8DC88A07, 0x783C88F0,
+ 0xE9FA26CF, 0x31965362, 0x53A7F5A6, 0x2D98775A,
+ 0xC5EC5297, 0x6DB8B7DA, 0x93C7A83B, 0x41AEC382,
+ 0xD2696BB9, 0x964BA731, 0x4BABDD96, 0x4FA9D19E,
+ 0xCE674F81, 0x140A3C28, 0x8E478F01, 0xF9F216EF,
+ 0x77B599EE, 0x4422CC88, 0xD7E564B3, 0xC1EE5E9F,
+ 0x61BEA3C2, 0x562BFAAC, 0x1F81213E, 0x24126C48,
+ 0x1B832D36, 0x361B5A6C, 0x1C0E2438, 0x4623CA8C,
+ 0xF7F504F3, 0x8A458309, 0x4221C684, 0x81CE9E1F,
+ 0x9249AB39, 0x582CE8B0, 0xEFF92CC3, 0xD1E66EBF,
+ 0x71B693E2, 0x5028F0A0, 0x2E17725C, 0x19822B32,
+ 0x341A5C68, 0x0B8B1D16, 0xE1FE3EDF, 0x098A1B12,
+ 0x12093624, 0x8FC98C03, 0x13873526, 0x9C4EB925,
+ 0xDFE17CA3, 0x5C2EE4B8, 0xD5E462B7, 0xDDE07AA7,
+ 0xCBEB408B, 0x3D90477A, 0x55A4FFAA, 0x3C1E4478,
+ 0x1785392E, 0xC0605D9D, 0x00000000, 0x4A25DE94,
+ 0xF5F402F7, 0xFFF11CE3, 0x35945F6A, 0x160B3A2C,
+ 0xD3E768BB, 0xEA7523C9, 0xC3EF589B, 0x6834B8D0,
+ 0x6231A6C4, 0xB5D4C277, 0xBDD0DA67, 0x11863322,
+ 0xFC7E19E5, 0x47ADC98E, 0xE7FD34D3, 0x5229F6A4,
+ 0x6030A0C0, 0x763B9AEC, 0x239F6546, 0xEDF82AC7,
+ 0x91C6AE3F, 0x26136A4C, 0x0C061418, 0x0A051E14,
+ 0x97C5A433, 0x22116644, 0xEE772FC1, 0xF87C15ED,
+ 0xF47A01F5, 0xF0780DFD, 0x6C36B4D8, 0x381C4870,
+ 0x723996E4, 0xB259CB79, 0x30185060, 0xAC56E945,
+ 0x7BB38DF6, 0x7DB087FA, 0x4824D890, 0x4020C080,
+ 0x79B28BF2, 0x39924B72, 0x5BA3EDB6, 0x9DC0BA27,
+ 0x8844850D, 0xC4625195, 0x20106040, 0x75B49FEA,
+ 0x15843F2A, 0x86439711, 0x3B934D76, 0x99C2B62F,
+ 0x944AA135, 0x67BDA9CE, 0x038F0506, 0x5A2DEEB4,
+ 0x65BCAFCA, 0x259C6F4A, 0xD46A61B5, 0x80409D1D,
+ 0x83CF981B, 0x59A2EBB2, 0x1D80273A, 0x9E4FBF21,
+ 0x3E1F427C, 0x89CA860F, 0x49AADB92, 0x84429115
+ };
+
+ private static readonly uint[] T2_tweaked =
+ {
+ 0xD2BBBA69, 0x4DE554A8, 0xBCE22F5E, 0xCD2574E8,
+ 0x51F753A6, 0x6BD0D3BB, 0x6FD6D2B9, 0x29B34D9A,
+ 0x5DFD50A0, 0x8ACFAC45, 0x0E098D07, 0xC6A5BF63,
+ 0xDD3D70E0, 0x55F152A4, 0x527B9A29, 0x2DB54C98,
+ 0x8F46EAC9, 0x73C4D5B7, 0x66559733, 0x63DCD1BF,
+ 0xCCAA3366, 0x59FB51A2, 0x71C75BB6, 0xA2F3A651,
+ 0x5FFEDEA1, 0x3DAD4890, 0x9AD7A84D, 0x5E71992F,
+ 0x4BE0DBAB, 0xC8AC3264, 0xE695B773, 0xD732FCE5,
+ 0xAB70E3DB, 0x42639E21, 0x7E41913F, 0x567D9B2B,
+ 0xAF76E2D9, 0xD6BDBB6B, 0x199B4182, 0xA5796EDC,
+ 0xAEF9A557, 0x0B80CB8B, 0xB1676BD6, 0x6E599537,
+ 0xBEE1A15F, 0xEB10F3FB, 0xFE81B17F, 0x080C0204,
+ 0x1792CC85, 0x37A2C495, 0x744E1D3A, 0x50781428,
+ 0x2BB0C39B, 0x915763C6, 0x4FE6DAA9, 0x69D35DBA,
+ 0x61DF5FBE, 0x57F2DCA5, 0xE9137DFA, 0x1394CD87,
+ 0xE11F7FFE, 0x75C15AB4, 0xAD756CD8, 0x6DD55CB8,
+ 0xFB08F7F3, 0x98D4264C, 0xDB38FFE3, 0x9354EDC7,
+ 0x874AE8CD, 0x4E699D27, 0xA17F6FDE, 0x02038E01,
+ 0x64561932, 0xBAE7A05D, 0xE71AF0FD, 0x1E11890F,
+ 0x3C220F1E, 0x1C12070E, 0x86C5AF43, 0xCB20FBEB,
+ 0x20300810, 0x547E152A, 0x342E0D1A, 0x10180408,
+ 0x04060102, 0x8D4564C8, 0x5BF8DFA3, 0xC52976EC,
+ 0xF90B79F2, 0x53F4DDA7, 0xF48E3D7A, 0x5874162C,
+ 0xFC823F7E, 0xDCB2376E, 0xA9736DDA, 0xE0903870,
+ 0xDEB1B96F, 0xD13773E6, 0x834CE9CF, 0xD4BE356A,
+ 0x49E355AA, 0xD93B71E2, 0xF1077BF6, 0x0A0F8C05,
+ 0xD53172E4, 0x1A17880D, 0xFF0EF6F1, 0xA8FC2A54,
+ 0xF8843E7C, 0x65D95EBC, 0x9CD2274E, 0x0589468C,
+ 0x30280C18, 0x894365CA, 0xBD6D68D0, 0x995B61C2,
+ 0x0C0A0306, 0x23BCC19F, 0x41EF57AE, 0x7FCED6B1,
+ 0x43ECD9AF, 0x7DCD58B0, 0x47EAD8AD, 0x854966CC,
+ 0x7BC8D7B3, 0xE89C3A74, 0x078AC88D, 0xF0883C78,
+ 0xCF26FAE9, 0x62539631, 0xA6F5A753, 0x5A77982D,
+ 0x9752ECC5, 0xDAB7B86D, 0x3BA8C793, 0x82C3AE41,
+ 0xB96B69D2, 0x31A74B96, 0x96DDAB4B, 0x9ED1A94F,
+ 0x814F67CE, 0x283C0A14, 0x018F478E, 0xEF16F2F9,
+ 0xEE99B577, 0x88CC2244, 0xB364E5D7, 0x9F5EEEC1,
+ 0xC2A3BE61, 0xACFA2B56, 0x3E21811F, 0x486C1224,
+ 0x362D831B, 0x6C5A1B36, 0x38240E1C, 0x8CCA2346,
+ 0xF304F5F7, 0x0983458A, 0x84C62142, 0x1F9ECE81,
+ 0x39AB4992, 0xB0E82C58, 0xC32CF9EF, 0xBF6EE6D1,
+ 0xE293B671, 0xA0F02850, 0x5C72172E, 0x322B8219,
+ 0x685C1A34, 0x161D8B0B, 0xDF3EFEE1, 0x121B8A09,
+ 0x24360912, 0x038CC98F, 0x26358713, 0x25B94E9C,
+ 0xA37CE1DF, 0xB8E42E5C, 0xB762E4D5, 0xA77AE0DD,
+ 0x8B40EBCB, 0x7A47903D, 0xAAFFA455, 0x78441E3C,
+ 0x2E398517, 0x9D5D60C0, 0x00000000, 0x94DE254A,
+ 0xF702F4F5, 0xE31CF1FF, 0x6A5F9435, 0x2C3A0B16,
+ 0xBB68E7D3, 0xC92375EA, 0x9B58EFC3, 0xD0B83468,
+ 0xC4A63162, 0x77C2D4B5, 0x67DAD0BD, 0x22338611,
+ 0xE5197EFC, 0x8EC9AD47, 0xD334FDE7, 0xA4F62952,
+ 0xC0A03060, 0xEC9A3B76, 0x46659F23, 0xC72AF8ED,
+ 0x3FAEC691, 0x4C6A1326, 0x1814060C, 0x141E050A,
+ 0x33A4C597, 0x44661122, 0xC12F77EE, 0xED157CF8,
+ 0xF5017AF4, 0xFD0D78F0, 0xD8B4366C, 0x70481C38,
+ 0xE4963972, 0x79CB59B2, 0x60501830, 0x45E956AC,
+ 0xF68DB37B, 0xFA87B07D, 0x90D82448, 0x80C02040,
+ 0xF28BB279, 0x724B9239, 0xB6EDA35B, 0x27BAC09D,
+ 0x0D854488, 0x955162C4, 0x40601020, 0xEA9FB475,
+ 0x2A3F8415, 0x11974386, 0x764D933B, 0x2FB6C299,
+ 0x35A14A94, 0xCEA9BD67, 0x06058F03, 0xB4EE2D5A,
+ 0xCAAFBC65, 0x4A6F9C25, 0xB5616AD4, 0x1D9D4080,
+ 0x1B98CF83, 0xB2EBA259, 0x3A27801D, 0x21BF4F9E,
+ 0x7C421F3E, 0x0F86CA89, 0x92DBAA49, 0x15914284
+ };
+
+ private static readonly uint[] T3_tweaked =
+ {
+ 0xBBD269BA, 0xE54DA854, 0xE2BC5E2F, 0x25CDE874,
+ 0xF751A653, 0xD06BBBD3, 0xD66FB9D2, 0xB3299A4D,
+ 0xFD5DA050, 0xCF8A45AC, 0x090E078D, 0xA5C663BF,
+ 0x3DDDE070, 0xF155A452, 0x7B52299A, 0xB52D984C,
+ 0x468FC9EA, 0xC473B7D5, 0x55663397, 0xDC63BFD1,
+ 0xAACC6633, 0xFB59A251, 0xC771B65B, 0xF3A251A6,
+ 0xFE5FA1DE, 0xAD3D9048, 0xD79A4DA8, 0x715E2F99,
+ 0xE04BABDB, 0xACC86432, 0x95E673B7, 0x32D7E5FC,
+ 0x70ABDBE3, 0x6342219E, 0x417E3F91, 0x7D562B9B,
+ 0x76AFD9E2, 0xBDD66BBB, 0x9B198241, 0x79A5DC6E,
+ 0xF9AE57A5, 0x800B8BCB, 0x67B1D66B, 0x596E3795,
+ 0xE1BE5FA1, 0x10EBFBF3, 0x81FE7FB1, 0x0C080402,
+ 0x921785CC, 0xA23795C4, 0x4E743A1D, 0x78502814,
+ 0xB02B9BC3, 0x5791C663, 0xE64FA9DA, 0xD369BA5D,
+ 0xDF61BE5F, 0xF257A5DC, 0x13E9FA7D, 0x941387CD,
+ 0x1FE1FE7F, 0xC175B45A, 0x75ADD86C, 0xD56DB85C,
+ 0x08FBF3F7, 0xD4984C26, 0x38DBE3FF, 0x5493C7ED,
+ 0x4A87CDE8, 0x694E279D, 0x7FA1DE6F, 0x0302018E,
+ 0x56643219, 0xE7BA5DA0, 0x1AE7FDF0, 0x111E0F89,
+ 0x223C1E0F, 0x121C0E07, 0xC58643AF, 0x20CBEBFB,
+ 0x30201008, 0x7E542A15, 0x2E341A0D, 0x18100804,
+ 0x06040201, 0x458DC864, 0xF85BA3DF, 0x29C5EC76,
+ 0x0BF9F279, 0xF453A7DD, 0x8EF47A3D, 0x74582C16,
+ 0x82FC7E3F, 0xB2DC6E37, 0x73A9DA6D, 0x90E07038,
+ 0xB1DE6FB9, 0x37D1E673, 0x4C83CFE9, 0xBED46A35,
+ 0xE349AA55, 0x3BD9E271, 0x07F1F67B, 0x0F0A058C,
+ 0x31D5E472, 0x171A0D88, 0x0EFFF1F6, 0xFCA8542A,
+ 0x84F87C3E, 0xD965BC5E, 0xD29C4E27, 0x89058C46,
+ 0x2830180C, 0x4389CA65, 0x6DBDD068, 0x5B99C261,
+ 0x0A0C0603, 0xBC239FC1, 0xEF41AE57, 0xCE7FB1D6,
+ 0xEC43AFD9, 0xCD7DB058, 0xEA47ADD8, 0x4985CC66,
+ 0xC87BB3D7, 0x9CE8743A, 0x8A078DC8, 0x88F0783C,
+ 0x26CFE9FA, 0x53623196, 0xF5A653A7, 0x775A2D98,
+ 0x5297C5EC, 0xB7DA6DB8, 0xA83B93C7, 0xC38241AE,
+ 0x6BB9D269, 0xA731964B, 0xDD964BAB, 0xD19E4FA9,
+ 0x4F81CE67, 0x3C28140A, 0x8F018E47, 0x16EFF9F2,
+ 0x99EE77B5, 0xCC884422, 0x64B3D7E5, 0x5E9FC1EE,
+ 0xA3C261BE, 0xFAAC562B, 0x213E1F81, 0x6C482412,
+ 0x2D361B83, 0x5A6C361B, 0x24381C0E, 0xCA8C4623,
+ 0x04F3F7F5, 0x83098A45, 0xC6844221, 0x9E1F81CE,
+ 0xAB399249, 0xE8B0582C, 0x2CC3EFF9, 0x6EBFD1E6,
+ 0x93E271B6, 0xF0A05028, 0x725C2E17, 0x2B321982,
+ 0x5C68341A, 0x1D160B8B, 0x3EDFE1FE, 0x1B12098A,
+ 0x36241209, 0x8C038FC9, 0x35261387, 0xB9259C4E,
+ 0x7CA3DFE1, 0xE4B85C2E, 0x62B7D5E4, 0x7AA7DDE0,
+ 0x408BCBEB, 0x477A3D90, 0xFFAA55A4, 0x44783C1E,
+ 0x392E1785, 0x5D9DC060, 0x00000000, 0xDE944A25,
+ 0x02F7F5F4, 0x1CE3FFF1, 0x5F6A3594, 0x3A2C160B,
+ 0x68BBD3E7, 0x23C9EA75, 0x589BC3EF, 0xB8D06834,
+ 0xA6C46231, 0xC277B5D4, 0xDA67BDD0, 0x33221186,
+ 0x19E5FC7E, 0xC98E47AD, 0x34D3E7FD, 0xF6A45229,
+ 0xA0C06030, 0x9AEC763B, 0x6546239F, 0x2AC7EDF8,
+ 0xAE3F91C6, 0x6A4C2613, 0x14180C06, 0x1E140A05,
+ 0xA43397C5, 0x66442211, 0x2FC1EE77, 0x15EDF87C,
+ 0x01F5F47A, 0x0DFDF078, 0xB4D86C36, 0x4870381C,
+ 0x96E47239, 0xCB79B259, 0x50603018, 0xE945AC56,
+ 0x8DF67BB3, 0x87FA7DB0, 0xD8904824, 0xC0804020,
+ 0x8BF279B2, 0x4B723992, 0xEDB65BA3, 0xBA279DC0,
+ 0x850D8844, 0x5195C462, 0x60402010, 0x9FEA75B4,
+ 0x3F2A1584, 0x97118643, 0x4D763B93, 0xB62F99C2,
+ 0xA135944A, 0xA9CE67BD, 0x0506038F, 0xEEB45A2D,
+ 0xAFCA65BC, 0x6F4A259C, 0x61B5D46A, 0x9D1D8040,
+ 0x981B83CF, 0xEBB259A2, 0x273A1D80, 0xBF219E4F,
+ 0x427C3E1F, 0x860F89CA, 0xDB9249AA, 0x91158442
+ };
+
+ private static readonly uint[] TK0_tweaked =
+ {
+ 0xBABABABA, 0x54545454, 0x2F2F2F2F, 0x74747474,
+ 0x53535353, 0xD3D3D3D3, 0xD2D2D2D2, 0x4D4D4D4D,
+ 0x50505050, 0xACACACAC, 0x8D8D8D8D, 0xBFBFBFBF,
+ 0x70707070, 0x52525252, 0x9A9A9A9A, 0x4C4C4C4C,
+ 0xEAEAEAEA, 0xD5D5D5D5, 0x97979797, 0xD1D1D1D1,
+ 0x33333333, 0x51515151, 0x5B5B5B5B, 0xA6A6A6A6,
+ 0xDEDEDEDE, 0x48484848, 0xA8A8A8A8, 0x99999999,
+ 0xDBDBDBDB, 0x32323232, 0xB7B7B7B7, 0xFCFCFCFC,
+ 0xE3E3E3E3, 0x9E9E9E9E, 0x91919191, 0x9B9B9B9B,
+ 0xE2E2E2E2, 0xBBBBBBBB, 0x41414141, 0x6E6E6E6E,
+ 0xA5A5A5A5, 0xCBCBCBCB, 0x6B6B6B6B, 0x95959595,
+ 0xA1A1A1A1, 0xF3F3F3F3, 0xB1B1B1B1, 0x02020202,
+ 0xCCCCCCCC, 0xC4C4C4C4, 0x1D1D1D1D, 0x14141414,
+ 0xC3C3C3C3, 0x63636363, 0xDADADADA, 0x5D5D5D5D,
+ 0x5F5F5F5F, 0xDCDCDCDC, 0x7D7D7D7D, 0xCDCDCDCD,
+ 0x7F7F7F7F, 0x5A5A5A5A, 0x6C6C6C6C, 0x5C5C5C5C,
+ 0xF7F7F7F7, 0x26262626, 0xFFFFFFFF, 0xEDEDEDED,
+ 0xE8E8E8E8, 0x9D9D9D9D, 0x6F6F6F6F, 0x8E8E8E8E,
+ 0x19191919, 0xA0A0A0A0, 0xF0F0F0F0, 0x89898989,
+ 0x0F0F0F0F, 0x07070707, 0xAFAFAFAF, 0xFBFBFBFB,
+ 0x08080808, 0x15151515, 0x0D0D0D0D, 0x04040404,
+ 0x01010101, 0x64646464, 0xDFDFDFDF, 0x76767676,
+ 0x79797979, 0xDDDDDDDD, 0x3D3D3D3D, 0x16161616,
+ 0x3F3F3F3F, 0x37373737, 0x6D6D6D6D, 0x38383838,
+ 0xB9B9B9B9, 0x73737373, 0xE9E9E9E9, 0x35353535,
+ 0x55555555, 0x71717171, 0x7B7B7B7B, 0x8C8C8C8C,
+ 0x72727272, 0x88888888, 0xF6F6F6F6, 0x2A2A2A2A,
+ 0x3E3E3E3E, 0x5E5E5E5E, 0x27272727, 0x46464646,
+ 0x0C0C0C0C, 0x65656565, 0x68686868, 0x61616161,
+ 0x03030303, 0xC1C1C1C1, 0x57575757, 0xD6D6D6D6,
+ 0xD9D9D9D9, 0x58585858, 0xD8D8D8D8, 0x66666666,
+ 0xD7D7D7D7, 0x3A3A3A3A, 0xC8C8C8C8, 0x3C3C3C3C,
+ 0xFAFAFAFA, 0x96969696, 0xA7A7A7A7, 0x98989898,
+ 0xECECECEC, 0xB8B8B8B8, 0xC7C7C7C7, 0xAEAEAEAE,
+ 0x69696969, 0x4B4B4B4B, 0xABABABAB, 0xA9A9A9A9,
+ 0x67676767, 0x0A0A0A0A, 0x47474747, 0xF2F2F2F2,
+ 0xB5B5B5B5, 0x22222222, 0xE5E5E5E5, 0xEEEEEEEE,
+ 0xBEBEBEBE, 0x2B2B2B2B, 0x81818181, 0x12121212,
+ 0x83838383, 0x1B1B1B1B, 0x0E0E0E0E, 0x23232323,
+ 0xF5F5F5F5, 0x45454545, 0x21212121, 0xCECECECE,
+ 0x49494949, 0x2C2C2C2C, 0xF9F9F9F9, 0xE6E6E6E6,
+ 0xB6B6B6B6, 0x28282828, 0x17171717, 0x82828282,
+ 0x1A1A1A1A, 0x8B8B8B8B, 0xFEFEFEFE, 0x8A8A8A8A,
+ 0x09090909, 0xC9C9C9C9, 0x87878787, 0x4E4E4E4E,
+ 0xE1E1E1E1, 0x2E2E2E2E, 0xE4E4E4E4, 0xE0E0E0E0,
+ 0xEBEBEBEB, 0x90909090, 0xA4A4A4A4, 0x1E1E1E1E,
+ 0x85858585, 0x60606060, 0x00000000, 0x25252525,
+ 0xF4F4F4F4, 0xF1F1F1F1, 0x94949494, 0x0B0B0B0B,
+ 0xE7E7E7E7, 0x75757575, 0xEFEFEFEF, 0x34343434,
+ 0x31313131, 0xD4D4D4D4, 0xD0D0D0D0, 0x86868686,
+ 0x7E7E7E7E, 0xADADADAD, 0xFDFDFDFD, 0x29292929,
+ 0x30303030, 0x3B3B3B3B, 0x9F9F9F9F, 0xF8F8F8F8,
+ 0xC6C6C6C6, 0x13131313, 0x06060606, 0x05050505,
+ 0xC5C5C5C5, 0x11111111, 0x77777777, 0x7C7C7C7C,
+ 0x7A7A7A7A, 0x78787878, 0x36363636, 0x1C1C1C1C,
+ 0x39393939, 0x59595959, 0x18181818, 0x56565656,
+ 0xB3B3B3B3, 0xB0B0B0B0, 0x24242424, 0x20202020,
+ 0xB2B2B2B2, 0x92929292, 0xA3A3A3A3, 0xC0C0C0C0,
+ 0x44444444, 0x62626262, 0x10101010, 0xB4B4B4B4,
+ 0x84848484, 0x43434343, 0x93939393, 0xC2C2C2C2,
+ 0x4A4A4A4A, 0xBDBDBDBD, 0x8F8F8F8F, 0x2D2D2D2D,
+ 0xBCBCBCBC, 0x9C9C9C9C, 0x6A6A6A6A, 0x40404040,
+ 0xCFCFCFCF, 0xA2A2A2A2, 0x80808080, 0x4F4F4F4F,
+ 0x1F1F1F1F, 0xCACACACA, 0xAAAAAAAA, 0x42424242
+ };
+
+ private static readonly uint[] TK1_tweaked =
+ {
+ 0x00000000, 0x01020608, 0x02040C10, 0x03060A18,
+ 0x04081820, 0x050A1E28, 0x060C1430, 0x070E1238,
+ 0x08103040, 0x09123648, 0x0A143C50, 0x0B163A58,
+ 0x0C182860, 0x0D1A2E68, 0x0E1C2470, 0x0F1E2278,
+ 0x10206080, 0x11226688, 0x12246C90, 0x13266A98,
+ 0x142878A0, 0x152A7EA8, 0x162C74B0, 0x172E72B8,
+ 0x183050C0, 0x193256C8, 0x1A345CD0, 0x1B365AD8,
+ 0x1C3848E0, 0x1D3A4EE8, 0x1E3C44F0, 0x1F3E42F8,
+ 0x2040C01D, 0x2142C615, 0x2244CC0D, 0x2346CA05,
+ 0x2448D83D, 0x254ADE35, 0x264CD42D, 0x274ED225,
+ 0x2850F05D, 0x2952F655, 0x2A54FC4D, 0x2B56FA45,
+ 0x2C58E87D, 0x2D5AEE75, 0x2E5CE46D, 0x2F5EE265,
+ 0x3060A09D, 0x3162A695, 0x3264AC8D, 0x3366AA85,
+ 0x3468B8BD, 0x356ABEB5, 0x366CB4AD, 0x376EB2A5,
+ 0x387090DD, 0x397296D5, 0x3A749CCD, 0x3B769AC5,
+ 0x3C7888FD, 0x3D7A8EF5, 0x3E7C84ED, 0x3F7E82E5,
+ 0x40809D3A, 0x41829B32, 0x4284912A, 0x43869722,
+ 0x4488851A, 0x458A8312, 0x468C890A, 0x478E8F02,
+ 0x4890AD7A, 0x4992AB72, 0x4A94A16A, 0x4B96A762,
+ 0x4C98B55A, 0x4D9AB352, 0x4E9CB94A, 0x4F9EBF42,
+ 0x50A0FDBA, 0x51A2FBB2, 0x52A4F1AA, 0x53A6F7A2,
+ 0x54A8E59A, 0x55AAE392, 0x56ACE98A, 0x57AEEF82,
+ 0x58B0CDFA, 0x59B2CBF2, 0x5AB4C1EA, 0x5BB6C7E2,
+ 0x5CB8D5DA, 0x5DBAD3D2, 0x5EBCD9CA, 0x5FBEDFC2,
+ 0x60C05D27, 0x61C25B2F, 0x62C45137, 0x63C6573F,
+ 0x64C84507, 0x65CA430F, 0x66CC4917, 0x67CE4F1F,
+ 0x68D06D67, 0x69D26B6F, 0x6AD46177, 0x6BD6677F,
+ 0x6CD87547, 0x6DDA734F, 0x6EDC7957, 0x6FDE7F5F,
+ 0x70E03DA7, 0x71E23BAF, 0x72E431B7, 0x73E637BF,
+ 0x74E82587, 0x75EA238F, 0x76EC2997, 0x77EE2F9F,
+ 0x78F00DE7, 0x79F20BEF, 0x7AF401F7, 0x7BF607FF,
+ 0x7CF815C7, 0x7DFA13CF, 0x7EFC19D7, 0x7FFE1FDF,
+ 0x801D2774, 0x811F217C, 0x82192B64, 0x831B2D6C,
+ 0x84153F54, 0x8517395C, 0x86113344, 0x8713354C,
+ 0x880D1734, 0x890F113C, 0x8A091B24, 0x8B0B1D2C,
+ 0x8C050F14, 0x8D07091C, 0x8E010304, 0x8F03050C,
+ 0x903D47F4, 0x913F41FC, 0x92394BE4, 0x933B4DEC,
+ 0x94355FD4, 0x953759DC, 0x963153C4, 0x973355CC,
+ 0x982D77B4, 0x992F71BC, 0x9A297BA4, 0x9B2B7DAC,
+ 0x9C256F94, 0x9D27699C, 0x9E216384, 0x9F23658C,
+ 0xA05DE769, 0xA15FE161, 0xA259EB79, 0xA35BED71,
+ 0xA455FF49, 0xA557F941, 0xA651F359, 0xA753F551,
+ 0xA84DD729, 0xA94FD121, 0xAA49DB39, 0xAB4BDD31,
+ 0xAC45CF09, 0xAD47C901, 0xAE41C319, 0xAF43C511,
+ 0xB07D87E9, 0xB17F81E1, 0xB2798BF9, 0xB37B8DF1,
+ 0xB4759FC9, 0xB57799C1, 0xB67193D9, 0xB77395D1,
+ 0xB86DB7A9, 0xB96FB1A1, 0xBA69BBB9, 0xBB6BBDB1,
+ 0xBC65AF89, 0xBD67A981, 0xBE61A399, 0xBF63A591,
+ 0xC09DBA4E, 0xC19FBC46, 0xC299B65E, 0xC39BB056,
+ 0xC495A26E, 0xC597A466, 0xC691AE7E, 0xC793A876,
+ 0xC88D8A0E, 0xC98F8C06, 0xCA89861E, 0xCB8B8016,
+ 0xCC85922E, 0xCD879426, 0xCE819E3E, 0xCF839836,
+ 0xD0BDDACE, 0xD1BFDCC6, 0xD2B9D6DE, 0xD3BBD0D6,
+ 0xD4B5C2EE, 0xD5B7C4E6, 0xD6B1CEFE, 0xD7B3C8F6,
+ 0xD8ADEA8E, 0xD9AFEC86, 0xDAA9E69E, 0xDBABE096,
+ 0xDCA5F2AE, 0xDDA7F4A6, 0xDEA1FEBE, 0xDFA3F8B6,
+ 0xE0DD7A53, 0xE1DF7C5B, 0xE2D97643, 0xE3DB704B,
+ 0xE4D56273, 0xE5D7647B, 0xE6D16E63, 0xE7D3686B,
+ 0xE8CD4A13, 0xE9CF4C1B, 0xEAC94603, 0xEBCB400B,
+ 0xECC55233, 0xEDC7543B, 0xEEC15E23, 0xEFC3582B,
+ 0xF0FD1AD3, 0xF1FF1CDB, 0xF2F916C3, 0xF3FB10CB,
+ 0xF4F502F3, 0xF5F704FB, 0xF6F10EE3, 0xF7F308EB,
+ 0xF8ED2A93, 0xF9EF2C9B, 0xFAE92683, 0xFBEB208B,
+ 0xFCE532B3, 0xFDE734BB, 0xFEE13EA3, 0xFFE338AB
+ };
+
+ private static readonly uint[] RCON_tweaked =
+ {
+ 0xBA542F74, 0x53D3D24D, 0x50AC8DBF, 0x70529A4C,
+ 0xEAD597D1, 0x33515BA6, 0xDE48A899, 0xDB32B7FC,
+ 0xE39E919B, 0xE2BB416E, 0xA5CB6B95, 0xA1F3B102,
+ 0xCCC41D14, 0xC363DA5D, 0x5FDC7DCD, 0x7F5A6C5C,
+ 0xF726FFED, 0xE89D6F8E, 0x19A0F089
+ };
+
+ private const int BLOCK_SIZE = 16;
+ private int ROUNDS;
+ private uint[,] workingKey;
+ private readonly uint[] T0;
+ private readonly uint[] T1;
+ private readonly uint[] T2;
+ private readonly uint[] T3;
+ private readonly uint[] TK0;
+ private readonly uint[] TK1;
+ private readonly uint[] RCON;
+
+ /**
+ * basic constructor
+ *
+ * @param tweaked whether to use new tweaked S-box.
+ */
+ public AnubisEngine(bool tweaked = true)
+ {
+ if (tweaked)
+ {
+ T0 = T0_tweaked;
+ T1 = T1_tweaked;
+ T2 = T2_tweaked;
+ T3 = T3_tweaked;
+ TK0 = TK0_tweaked;
+ TK1 = TK1_tweaked;
+ RCON = RCON_tweaked;
+ }
+ else
+ {
+ T0 = T0_original;
+ T1 = T1_original;
+ T2 = T2_original;
+ T3 = T3_original;
+ TK0 = TK0_original;
+ TK1 = TK1_original;
+ RCON = RCON_original;
+ }
+ }
+
+ /**
+ * Calculate the round keys
+ */
+ private uint[,] GenerateWorkingKey(
+ byte[] key,
+ bool forEncryption)
+ {
+ uint[] kx = new uint[key.Length >> 2];
+ uint[] x = new uint[kx.Length];
+
+ ROUNDS = 8 + kx.Length;
+
+ uint[,] wk = new uint[ROUNDS + 1, 4];
+
+ for (int i = 0; i < key.Length; i++)
+ kx[i >> 2] |= (uint)key[i] << (24 - ((i & 3) << 3));
+
+ /* generate rounds + 1 round keys */
+ for (uint r = 0; r <= ROUNDS; r++)
+ {
+ /* generate r-th round key K^r */
+ uint t0 = TK0[kx[kx.Length - 1] >> 24];
+ uint t1 = TK0[(kx[kx.Length - 1] >> 16) & 0xFF];
+ uint t2 = TK0[(kx[kx.Length - 1] >> 8) & 0xFF];
+ uint t3 = TK0[kx[kx.Length - 1] & 0xFF];
+
+ for (int i = kx.Length - 2; i >= 0; i--)
+ {
+ t0 = TK0[kx[i] >> 24] ^
+ ((t0 & 0xFF000000) |
+ (TK1[(t0 >> 16) & 0xFF] & 0xFF0000) |
+ (TK1[(t0 >> 8) & 0xFF] & 0xFF00) |
+ (TK1[t0 & 0xFF] & 0xFF));
+
+ t1 = TK0[(kx[i] >> 16) & 0xFF] ^
+ ((t1 & 0xFF000000) |
+ (TK1[(t1 >> 16) & 0xFF] & 0xFF0000) |
+ (TK1[(t1 >> 8) & 0xFF] & 0xFF00) |
+ (TK1[t1 & 0xFF] & 0xFF));
+
+ t2 = TK0[(kx[i] >> 8) & 0xFF] ^
+ ((t2 & 0xFF000000) |
+ (TK1[(t2 >> 16) & 0xFF] & 0xFF0000) |
+ (TK1[(t2 >> 8) & 0xFF] & 0xFF00) |
+ (TK1[t2 & 0xFF] & 0xFF));
+
+ t3 = TK0[kx[i] & 0xFF] ^
+ ((t3 & 0xFF000000) |
+ (TK1[(t3 >> 16) & 0xFF] & 0xFF0000) |
+ (TK1[(t3 >> 8) & 0xFF] & 0xFF00) |
+ (TK1[t3 & 0xFF] & 0xFF));
+ }
+
+ wk[r, 0] = t0;
+ wk[r, 1] = t1;
+ wk[r, 2] = t2;
+ wk[r, 3] = t3;
+
+ if (r == ROUNDS) break;
+
+ /* compute kx^{r+1} from kx^r */
+ for (int i = 0; i < kx.Length; i++)
+ {
+ int j = i;
+ x[i] = T0[kx[j--] >> 24]; if (j < 0) j = kx.Length - 1;
+ x[i] ^= T1[(kx[j--] >> 16) & 0xFF]; if (j < 0) j = kx.Length - 1;
+ x[i] ^= T2[(kx[j--] >> 8) & 0xFF]; if (j < 0) j = kx.Length - 1;
+ x[i] ^= T3[kx[j] & 0xFF];
+ }
+ kx[0] = x[0] ^ RCON[r];
+ for (int i = 1; i < kx.Length; i++)
+ kx[i] = x[i];
+ }
+
+ if (forEncryption)
+ return wk;
+
+ /* generate inverse key schedule */
+ uint[,] iwk = new uint[ROUNDS + 1, 4];
+
+ for (uint i = 0; i < 4; i++)
+ {
+ iwk[0, i] = wk[ROUNDS, i];
+ iwk[ROUNDS, i] = wk[0, i];
+ }
+
+ for (uint r = 1; r < ROUNDS; r++)
+ {
+ for (uint i = 0; i < 4; i++)
+ {
+ uint t = wk[ROUNDS - r, i];
+
+ iwk[r, i] = T0[TK0[t >> 24] & 0xFF] ^
+ T1[TK0[(t >> 16) & 0xFF] & 0xFF] ^
+ T2[TK0[(t >> 8) & 0xFF] & 0xFF] ^
+ T3[TK0[t & 0xFF] & 0xFF];
+ }
+ }
+
+ return iwk;
+ }
+
+ /**
+ * initialise a Anubis cipher.
+ *
+ * @param forEncryption whether or not we are for encryption.
+ * @param parameters the parameters required to set up the cipher.
+ * @exception ArgumentException if the parameters argument is
+ * inappropriate.
+ */
+ public virtual void Init(
+ bool forEncryption,
+ ICipherParameters parameters)
+ {
+ if (typeof(KeyParameter).IsInstanceOfType(parameters))
+ {
+ byte[] key = ((KeyParameter)parameters).GetKey();
+
+ if (key.Length < 16 || key.Length > 40 || key.Length % 4 != 0)
+ throw new ArgumentException("Key length not 128/160/192/224/256/288/320 bits.");
+
+ workingKey = GenerateWorkingKey(key, forEncryption);
+ return;
+ }
+
+ throw new ArgumentException("invalid parameter passed to Anubis init - " + Platform.GetTypeName(parameters));
+ }
+
+ public virtual string AlgorithmName
+ {
+ get { return "Anubis"; }
+ }
+
+ public virtual bool IsPartialBlockOkay
+ {
+ get { return false; }
+ }
+
+ public virtual int GetBlockSize()
+ {
+ return BLOCK_SIZE;
+ }
+
+ public virtual int ProcessBlock(
+ byte[] input,
+ int inOff,
+ byte[] output,
+ int outOff)
+ {
+ if (workingKey == null)
+ throw new InvalidOperationException("Anubis engine not initialised");
+
+ Check.DataLength(input, inOff, BLOCK_SIZE, "input buffer too short");
+ Check.OutputLength(output, outOff, BLOCK_SIZE, "output buffer too short");
+
+ uint x0 = Pack.BE_To_UInt32(input, inOff) ^ workingKey[0, 0];
+ uint x1 = Pack.BE_To_UInt32(input, inOff + 4) ^ workingKey[0, 1];
+ uint x2 = Pack.BE_To_UInt32(input, inOff + 8) ^ workingKey[0, 2];
+ uint x3 = Pack.BE_To_UInt32(input, inOff + 12) ^ workingKey[0, 3];
+ uint t0;
+ uint t1;
+ uint t2;
+
+ /* r - 1 full rounds */
+ for (uint i = 1; i < ROUNDS; i++)
+ {
+ t0 = T0[x0 >> 24] ^
+ T1[x1 >> 24] ^
+ T2[x2 >> 24] ^
+ T3[x3 >> 24] ^
+ workingKey[i, 0];
+
+ t1 = T0[(x0 >> 16) & 0xFF] ^
+ T1[(x1 >> 16) & 0xFF] ^
+ T2[(x2 >> 16) & 0xFF] ^
+ T3[(x3 >> 16) & 0xFF] ^
+ workingKey[i, 1];
+
+ t2 = T0[(x0 >> 8) & 0xFF] ^
+ T1[(x1 >> 8) & 0xFF] ^
+ T2[(x2 >> 8) & 0xFF] ^
+ T3[(x3 >> 8) & 0xFF] ^
+ workingKey[i, 2];
+
+ x3 = T0[x0 & 0xFF] ^
+ T1[x1 & 0xFF] ^
+ T2[x2 & 0xFF] ^
+ T3[x3 & 0xFF] ^
+ workingKey[i, 3];
+
+ x0 = t0;
+ x1 = t1;
+ x2 = t2;
+ }
+
+ /* last round */
+ t0 = ((T0[x0 >> 24] & 0xFF000000) |
+ (T1[x1 >> 24] & 0x00FF0000) |
+ (T2[x2 >> 24] & 0x0000FF00) |
+ (T3[x3 >> 24] & 0x000000FF)) ^
+ workingKey[ROUNDS, 0];
+
+ t1 = ((T0[(x0 >> 16) & 0xFF] & 0xFF000000) |
+ (T1[(x1 >> 16) & 0xFF] & 0x00FF0000) |
+ (T2[(x2 >> 16) & 0xFF] & 0x0000FF00) |
+ (T3[(x3 >> 16) & 0xFF] & 0x000000FF)) ^
+ workingKey[ROUNDS, 1];
+
+ t2 = ((T0[(x0 >> 8) & 0xFF] & 0xFF000000) |
+ (T1[(x1 >> 8) & 0xFF] & 0x00FF0000) |
+ (T2[(x2 >> 8) & 0xFF] & 0x0000FF00) |
+ (T3[(x3 >> 8) & 0xFF] & 0x000000FF)) ^
+ workingKey[ROUNDS, 2];
+
+ x3 = ((T0[x0 & 0xFF] & 0xFF000000) |
+ (T1[x1 & 0xFF] & 0x00FF0000) |
+ (T2[x2 & 0xFF] & 0x0000FF00) |
+ (T3[x3 & 0xFF] & 0x000000FF)) ^
+ workingKey[ROUNDS, 3];
+
+ Pack.UInt32_To_BE(t0, output, outOff);
+ Pack.UInt32_To_BE(t1, output, outOff + 4);
+ Pack.UInt32_To_BE(t2, output, outOff + 8);
+ Pack.UInt32_To_BE(x3, output, outOff + 12);
+
+ return BLOCK_SIZE;
+ }
+
+ public virtual void Reset()
+ {
+ }
+ }
+}
diff --git a/crypto/test/UnitTests.csproj b/crypto/test/UnitTests.csproj
index 72d9e6320e..4916abc480 100644
--- a/crypto/test/UnitTests.csproj
+++ b/crypto/test/UnitTests.csproj
@@ -162,6 +162,7 @@
+
diff --git a/crypto/test/src/crypto/test/AnubisTest.cs b/crypto/test/src/crypto/test/AnubisTest.cs
new file mode 100644
index 0000000000..14c4833fd1
--- /dev/null
+++ b/crypto/test/src/crypto/test/AnubisTest.cs
@@ -0,0 +1,155 @@
+using System;
+
+using NUnit.Framework;
+
+using Org.BouncyCastle.Crypto.Engines;
+using Org.BouncyCastle.Crypto.Parameters;
+using Org.BouncyCastle.Utilities.Encoders;
+using Org.BouncyCastle.Utilities.Test;
+
+namespace Org.BouncyCastle.Crypto.Tests
+{
+ /// Test vectors from the Anubis page
+ ///
+ /// https://web.archive.org/web/20110706163044/http://www.larc.usp.br/~pbarreto/AnubisPage.html
+ ///
+ [TestFixture]
+ public class AnubisTest : CipherTest
+ {
+ internal static SimpleTest[] tests = new SimpleTest[]{
+ // original 128-bit key
+ new BlockCipherVectorTest(0, new AnubisEngine(false), new KeyParameter(Hex.Decode("80000000000000000000000000000000")), "00000000000000000000000000000000", "F06860FC6730E818F132C78AF4132AFE"),
+ new BlockCipherVectorTest(1, new AnubisEngine(false), new KeyParameter(Hex.Decode("00000000000000000000000000000001")), "00000000000000000000000000000000", "A866848007745C89FC5EB5BAD4FE326D"),
+ new BlockCipherVectorTest(2, new AnubisEngine(false), new KeyParameter(Hex.Decode("00000000000000000000000000000000")), "00002000000000000000000000000000", "0D2A223BDF76B61029C3C3A4A72E364F"),
+ new BlockCipherMonteCarloTest(3, 1000, new AnubisEngine(false), new KeyParameter(Hex.Decode("01010101010101010101010101010101")), "01010101010101010101010101010101", "D64394E88C2B445407FBC3D4DB588C14"),
+ new BlockCipherMonteCarloTest(4, 1000, new AnubisEngine(false), new KeyParameter(Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF")), "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "EBDE86CC68308A7276ABA67E2C8782F5"),
+
+ // original 160-bit key
+ new BlockCipherVectorTest(5, new AnubisEngine(false), new KeyParameter(Hex.Decode("8000000000000000000000000000000000000000")), "00000000000000000000000000000000", "BD5E32BE5167A8E272D7950F83C68C31"),
+ new BlockCipherVectorTest(6, new AnubisEngine(false), new KeyParameter(Hex.Decode("0000000000000000000000000000000000000001")), "00000000000000000000000000000000", "4C1F862E11EBCEEBFEB973C9DFEF7ADB"),
+ new BlockCipherVectorTest(7, new AnubisEngine(false), new KeyParameter(Hex.Decode("0000000000000000000000000000000000000000")), "08000000000000000000000000000000", "ABF31F362CEB8B070357ADBA5396A361"),
+ new BlockCipherMonteCarloTest(8, 1000, new AnubisEngine(false), new KeyParameter(Hex.Decode("0202020202020202020202020202020202020202")), "02020202020202020202020202020202", "D4A7F3B370F5EDDB809F80B8B47C185E"),
+ new BlockCipherMonteCarloTest(9, 1000, new AnubisEngine(false), new KeyParameter(Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF")), "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "43F088A1FE8E4AC52C8CAFAF0147B74B"),
+
+ // original 192-bit key
+ new BlockCipherVectorTest(10, new AnubisEngine(false), new KeyParameter(Hex.Decode("800000000000000000000000000000000000000000000000")), "00000000000000000000000000000000", "17AC57449D596166D0C79E047CC758F0"),
+ new BlockCipherVectorTest(11, new AnubisEngine(false), new KeyParameter(Hex.Decode("000000000000000000000000000000000000000000000001")), "00000000000000000000000000000000", "7152B4EB1DAA36FD57145F57049F7074"),
+ new BlockCipherVectorTest(12, new AnubisEngine(false), new KeyParameter(Hex.Decode("000000000000000000000000000000000000000000000000")), "00000040000000000000000000000000", "F520671672026AE069D77A956F9682CA"),
+ new BlockCipherMonteCarloTest(13, 1000, new AnubisEngine(false), new KeyParameter(Hex.Decode("020202020202020202020202020202020202020202020202")), "02020202020202020202020202020202", "EFE787A370975017787EA1E8D22CE841"),
+ new BlockCipherMonteCarloTest(14, 1000, new AnubisEngine(false), new KeyParameter(Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF")), "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "B1ED0EC32DECC9EEBDF499F2D65FCF57"),
+
+ // original 224-bit key
+ new BlockCipherVectorTest(15, new AnubisEngine(false), new KeyParameter(Hex.Decode("80000000000000000000000000000000000000000000000000000000")), "00000000000000000000000000000000", "A2F0A6B917932A3BEF08E87A58D6F853"),
+ new BlockCipherVectorTest(16, new AnubisEngine(false), new KeyParameter(Hex.Decode("00000000000000000000000000000000000000000000000000000001")), "00000000000000000000000000000000", "F0CAFC788B4B4E538BC4326AF5B91B5F"),
+ new BlockCipherVectorTest(17, new AnubisEngine(false), new KeyParameter(Hex.Decode("00000000000000000000000000000000000000000000000000000000")), "00000040000000000000000000000000", "A7524A0F9F62386BBFDAFC0F3BA30BF8"),
+ new BlockCipherMonteCarloTest(18, 1000, new AnubisEngine(false), new KeyParameter(Hex.Decode("03030303030303030303030303030303030303030303030303030303")), "03030303030303030303030303030303", "DF5C5C86180AB920C0DB858C524C526A"),
+ new BlockCipherMonteCarloTest(19, 1000, new AnubisEngine(false), new KeyParameter(Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF")), "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "C9E01319C74002A9A66A25BDDE5332BA"),
+
+ // original 256-bit key
+ new BlockCipherVectorTest(20, new AnubisEngine(false), new KeyParameter(Hex.Decode("8000000000000000000000000000000000000000000000000000000000000000")), "00000000000000000000000000000000", "E086AC456B3CE513EDF5DFDDD63B7193"),
+ new BlockCipherVectorTest(21, new AnubisEngine(false), new KeyParameter(Hex.Decode("0000000000000000000000000000000000000000000000000000000000000001")), "00000000000000000000000000000000", "5001B9F521C1C12900D5EC982B9EE821"),
+ new BlockCipherVectorTest(22, new AnubisEngine(false), new KeyParameter(Hex.Decode("0000000000000000000000000000000000000000000000000000000000000000")), "00000040000000000000000000000000", "4503AB1725E2297860CABDBF4C394692"),
+ new BlockCipherMonteCarloTest(23, 1000, new AnubisEngine(false), new KeyParameter(Hex.Decode("0404040404040404040404040404040404040404040404040404040404040404")), "04040404040404040404040404040404", "9E4D164F3AD58CEF00BE9A379F3C8541"),
+ new BlockCipherMonteCarloTest(24, 1000, new AnubisEngine(false), new KeyParameter(Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF")), "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "33AAA7BFA94094614165A9824B3DCE98"),
+
+ // original 288-bit key
+ new BlockCipherVectorTest(25, new AnubisEngine(false), new KeyParameter(Hex.Decode("800000000000000000000000000000000000000000000000000000000000000000000000")), "00000000000000000000000000000000", "E8F4AF2B21A0879B4195B9717579047C"),
+ new BlockCipherVectorTest(26, new AnubisEngine(false), new KeyParameter(Hex.Decode("000000000000000000000000000000000000000000000000000000000000000000000001")), "00000000000000000000000000000000", "E6A6A5BC8B636FE2BDA7A753AB4022E0"),
+ new BlockCipherVectorTest(27, new AnubisEngine(false), new KeyParameter(Hex.Decode("000000000000000000000000000000000000000000000000000000000000000000000000")), "00000040000000000000000000000000", "060BFD8935F1A99B45981321FEDF6122"),
+ new BlockCipherMonteCarloTest(28, 1000, new AnubisEngine(false), new KeyParameter(Hex.Decode("050505050505050505050505050505050505050505050505050505050505050505050505")), "05050505050505050505050505050505", "02B6E591A8C94FDE6908960FCC725B78"),
+ new BlockCipherMonteCarloTest(29, 1000, new AnubisEngine(false), new KeyParameter(Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF")), "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "C8DBC1AC75552F64A0FDD6AE75884131"),
+
+ // original 320-bit key
+ new BlockCipherVectorTest(30, new AnubisEngine(false), new KeyParameter(Hex.Decode("80000000000000000000000000000000000000000000000000000000000000000000000000000000")), "00000000000000000000000000000000", "1704D72CC68576024BCC3980D822EAA4"),
+ new BlockCipherVectorTest(31, new AnubisEngine(false), new KeyParameter(Hex.Decode("00000000000000000000000000000000000000000000000000000000000000000000000000000001")), "00000000000000000000000000000000", "7A41E67D4FD864F044A83C73817E53D8"),
+ new BlockCipherVectorTest(32, new AnubisEngine(false), new KeyParameter(Hex.Decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000")), "00000040000000000000000000000000", "B77EE2BFEEFC03C8DB8A38710A0F17B6"),
+ new BlockCipherMonteCarloTest(33, 1000, new AnubisEngine(false), new KeyParameter(Hex.Decode("06060606060606060606060606060606060606060606060606060606060606060606060606060606")), "06060606060606060606060606060606", "89F3EB6684C6A7D50738BDA53EB09D26"),
+ new BlockCipherMonteCarloTest(34, 1000, new AnubisEngine(false), new KeyParameter(Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF")), "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "18A34EB875E196727919418FB8540967"),
+
+
+ // tweaked 128-bit key
+ new BlockCipherVectorTest(35, new AnubisEngine(true), new KeyParameter(Hex.Decode("80000000000000000000000000000000")), "00000000000000000000000000000000", "B835BDC334829D8371BFA371E4B3C4FD"),
+ new BlockCipherVectorTest(36, new AnubisEngine(true), new KeyParameter(Hex.Decode("00000000000000000000000000000001")), "00000000000000000000000000000000", "E6141EAFEBE0593C48E1CDF21BBAA189"),
+ new BlockCipherVectorTest(37, new AnubisEngine(true), new KeyParameter(Hex.Decode("00000000000000000000000000000000")), "00002000000000000000000000000000", "E0D5FD6C8EFC1CFE17819DA6010E8BCD"),
+ new BlockCipherMonteCarloTest(38, 1000, new AnubisEngine(true), new KeyParameter(Hex.Decode("01010101010101010101010101010101")), "01010101010101010101010101010101", "8C0A6F8255C005ED91AD08406C61C367"),
+ new BlockCipherMonteCarloTest(39, 1000, new AnubisEngine(true), new KeyParameter(Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF")), "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "D58CACBA4FB8499A67F8C7DD13B97429"),
+
+ // tweaked 160-bit key
+ new BlockCipherVectorTest(40, new AnubisEngine(true), new KeyParameter(Hex.Decode("8000000000000000000000000000000000000000")), "00000000000000000000000000000000", "9759794B5CA0707324EFB35867CAD4B3"),
+ new BlockCipherVectorTest(41, new AnubisEngine(true), new KeyParameter(Hex.Decode("0000000000000000000000000000000000000001")), "00000000000000000000000000000000", "B80DFB9BE4A15887B376D5021895C12E"),
+ new BlockCipherVectorTest(42, new AnubisEngine(true), new KeyParameter(Hex.Decode("0000000000000000000000000000000000000000")), "08000000000000000000000000000000", "11A07ACABDBF29A06E3A9F080B77B1F5"),
+ new BlockCipherMonteCarloTest(43, 1000, new AnubisEngine(true), new KeyParameter(Hex.Decode("0202020202020202020202020202020202020202")), "02020202020202020202020202020202", "3F76D732983E0092AC446F1B16C84EBB"),
+ new BlockCipherMonteCarloTest(44, 1000, new AnubisEngine(true), new KeyParameter(Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF")), "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "47C12314BF9FEC1276A6A2536F35D213"),
+
+ // tweaked 192-bit key
+ new BlockCipherVectorTest(45, new AnubisEngine(true), new KeyParameter(Hex.Decode("800000000000000000000000000000000000000000000000")), "00000000000000000000000000000000", "7D623B52C74C64D8EBC72D579785438F"),
+ new BlockCipherVectorTest(46, new AnubisEngine(true), new KeyParameter(Hex.Decode("000000000000000000000000000000000000000000000001")), "00000000000000000000000000000000", "B10A59DD5D5D8D67ECEE4AC4BE4FA84F"),
+ new BlockCipherVectorTest(47, new AnubisEngine(true), new KeyParameter(Hex.Decode("000000000000000000000000000000000000000000000000")), "00000040000000000000000000000000", "A8D627B2243C89648C3488276EC7E8F4"),
+ new BlockCipherMonteCarloTest(48, 1000, new AnubisEngine(true), new KeyParameter(Hex.Decode("020202020202020202020202020202020202020202020202")), "02020202020202020202020202020202", "72387FC8F2548A8CCEF06FA776C87D60"),
+ new BlockCipherMonteCarloTest(49, 1000, new AnubisEngine(true), new KeyParameter(Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF")), "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "33EEF7CDA63DCAFC40DAA81C91C77598"),
+
+ // tweaked 224-bit key
+ new BlockCipherVectorTest(50, new AnubisEngine(true), new KeyParameter(Hex.Decode("80000000000000000000000000000000000000000000000000000000")), "00000000000000000000000000000000", "689E05946A94438FE78E373D249792F5"),
+ new BlockCipherVectorTest(51, new AnubisEngine(true), new KeyParameter(Hex.Decode("00000000000000000000000000000000000000000000000000000001")), "00000000000000000000000000000000", "DDB7B0B4E9B49B9C3820250B47C21F89"),
+ new BlockCipherVectorTest(52, new AnubisEngine(true), new KeyParameter(Hex.Decode("00000000000000000000000000000000000000000000000000000000")), "00000040000000000000000000000000", "F18A0E8CB6836C2629F7AED843B340ED"),
+ new BlockCipherMonteCarloTest(53, 1000, new AnubisEngine(true), new KeyParameter(Hex.Decode("03030303030303030303030303030303030303030303030303030303")), "03030303030303030303030303030303", "F69A2EA6CA33AC31ACB624DF1B30D2B0"),
+ new BlockCipherMonteCarloTest(54, 1000, new AnubisEngine(true), new KeyParameter(Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF")), "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "5C4C45A8D065254A9B1E6D24DD94867F"),
+
+ // tweaked 256-bit key
+ new BlockCipherVectorTest(55, new AnubisEngine(true), new KeyParameter(Hex.Decode("8000000000000000000000000000000000000000000000000000000000000000")), "00000000000000000000000000000000", "9600F07691692987F5E597DBDBAF1B0A"),
+ new BlockCipherVectorTest(56, new AnubisEngine(true), new KeyParameter(Hex.Decode("0000000000000000000000000000000000000000000000000000000000000001")), "00000000000000000000000000000000", "699CAFDD94C7BC6044FE02058A6EEFBD"),
+ new BlockCipherVectorTest(57, new AnubisEngine(true), new KeyParameter(Hex.Decode("0000000000000000000000000000000000000000000000000000000000000000")), "00000040000000000000000000000000", "206919B913D7F28041DC4398B764F2E8"),
+ new BlockCipherMonteCarloTest(58, 1000, new AnubisEngine(true), new KeyParameter(Hex.Decode("0404040404040404040404040404040404040404040404040404040404040404")), "04040404040404040404040404040404", "650698D33A6E68853B78478960B74360"),
+ new BlockCipherMonteCarloTest(59, 1000, new AnubisEngine(true), new KeyParameter(Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF")), "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "55317E05B00DFEA707BA261F1C018BA4"),
+
+ // tweaked 288-bit key
+ new BlockCipherVectorTest(60, new AnubisEngine(true), new KeyParameter(Hex.Decode("800000000000000000000000000000000000000000000000000000000000000000000000")), "00000000000000000000000000000000", "0FC7A2C01117AC43525EDF6CF396336C"),
+ new BlockCipherVectorTest(61, new AnubisEngine(true), new KeyParameter(Hex.Decode("000000000000000000000000000000000000000000000000000000000000000000000001")), "00000000000000000000000000000000", "AD084FED55A6943E7E5EED05A19D41B4"),
+ new BlockCipherVectorTest(62, new AnubisEngine(true), new KeyParameter(Hex.Decode("000000000000000000000000000000000000000000000000000000000000000000000000")), "00000040000000000000000000000000", "33A050BF3B2588B068B597141AE165B7"),
+ new BlockCipherMonteCarloTest(63, 1000, new AnubisEngine(true), new KeyParameter(Hex.Decode("050505050505050505050505050505050505050505050505050505050505050505050505")), "05050505050505050505050505050505", "06473A9A0AE0B73062A3E02FCD1C23DF"),
+ new BlockCipherMonteCarloTest(64, 1000, new AnubisEngine(true), new KeyParameter(Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF")), "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "CBB41074942707CBBFDBF97EC0452F94"),
+
+ // tweaked 320-bit key
+ new BlockCipherVectorTest(65, new AnubisEngine(true), new KeyParameter(Hex.Decode("80000000000000000000000000000000000000000000000000000000000000000000000000000000")), "00000000000000000000000000000000", "FEE20E2A9DC583BAA3A6D6A6F2E806A5"),
+ new BlockCipherVectorTest(66, new AnubisEngine(true), new KeyParameter(Hex.Decode("00000000000000000000000000000000000000000000000000000000000000000000000000000001")), "00000000000000000000000000000000", "863DCC4A60349C28A7DAA43B0AD7FDC7"),
+ new BlockCipherVectorTest(67, new AnubisEngine(true), new KeyParameter(Hex.Decode("00000000000000000000000000000000000000000000000000000000000000000000000000000000")), "00000040000000000000000000000000", "ACF7151F51BE8F730363F57C81030E50"),
+ new BlockCipherMonteCarloTest(68, 1000, new AnubisEngine(true), new KeyParameter(Hex.Decode("06060606060606060606060606060606060606060606060606060606060606060606060606060606")), "06060606060606060606060606060606", "FCE47BAA9ABB2A29E8AA6F2A8AB958DD"),
+ new BlockCipherMonteCarloTest(69, 1000, new AnubisEngine(true), new KeyParameter(Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF")), "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", "826BE24DE86F7DB86A5508590C2D8C37")
+ };
+
+ public override string Name { get { return "Anubis"; } }
+
+ public AnubisTest()
+ : base(tests, new AnubisEngine(), new KeyParameter(new byte[16]))
+ {
+ }
+
+ public override ITestResult Perform()
+ {
+ ITestResult result = base.Perform();
+ if (!result.IsSuccessful())
+ {
+ return result;
+ }
+
+ return new SimpleTestResult(true, Name + ": Okay");
+ }
+
+ public static void Main(
+ string[] args)
+ {
+ AnubisTest test = new AnubisTest();
+ ITestResult result = test.Perform();
+
+ Console.WriteLine(result);
+ }
+
+ [Test]
+ public void TestFunction()
+ {
+ string resultText = Perform().ToString();
+
+ Assert.AreEqual(Name + ": Okay", resultText);
+ }
+ }
+}