-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPoseidon_S45a.h
82 lines (82 loc) · 5.94 KB
/
Poseidon_S45a.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
const int CONST_N1 = 34;
const int CONST_N2 = 3;
const F CONST[34][3] = {
{
(EXP2(64) * 0x328f06dull + 0xb5f544aad1040e58ull) , (EXP2(64) * 0x394df3cull + 0xd5c48683db8359d2ull) , (EXP2(64) * 0x3bce0c3ull + 0x7c3991b63f526454ull) , },
{
(EXP2(64) * 0x277aa08ull + 0x977c80e0a7b5217ull) , (EXP2(64) * 0x61a17a1ull + 0x2092b8db4c0f8d98ull) , (EXP2(64) * 0x34f96d4ull + 0x4fee90e9975a58e8ull) , },
{
(EXP2(64) * 0x50e5b27ull + 0xcc4fb2a75a00772aull) , (EXP2(64) * 0x425850cull + 0xfe329811fc13be5cull) , (EXP2(64) * 0x4e31023ull + 0x9c6adeb452025dfdull) , },
{
(EXP2(64) * 0x5d8c088ull + 0x2fe1eb9285a5666cull) , (EXP2(64) * 0x2be7710ull + 0x37f29bca17c96f93ull) , (EXP2(64) * 0x1bf9108ull + 0xd0c835d9731f4ccaull) , },
{
(EXP2(64) * 0x351971eull + 0xd98dbdec508968ebull) , (EXP2(64) * 0x3ae918bull + 0x7ba62003f09236bcull) , (EXP2(64) * 0x5cac6f1ull + 0x107f8c2a3602a635ull) , },
{
(EXP2(64) * 0x3467f85ull + 0xf6e6098331dadc5dull) , (EXP2(64) * 0x2b91b8bull + 0xd429f511bd60ba82ull) , (EXP2(64) * 0x6269307ull + 0x85cdc18c088ac0bull) , },
{
(EXP2(64) * 0x6ed7270ull + 0x63fc40d5efb86d39ull) , (EXP2(64) * 0x7884905ull + 0x63a80a6c37b37a70ull) , (EXP2(64) * 0x77823a7ull + 0xb577d54e59e08af6ull) , },
{
(EXP2(64) * 0x3777aa9ull + 0x3f615309a565bc37ull) , (EXP2(64) * 0x12d0964ull + 0x5b55816cb513eee8ull) , (EXP2(64) * 0x1001fbull + 0x837d8a8e17ec659cull) , },
{
(EXP2(64) * 0x1d1f36bull + 0x4d81fcf20479d22dull) , (EXP2(64) * 0x6164139ull + 0x3606ebc78447b167ull) , (EXP2(64) * 0x5c7afddull + 0x6c0ea236ac3b642full) , },
{
(EXP2(64) * 0x245e8a4ull + 0x7479add69ceabdf1ull) , (EXP2(64) * 0x610d921ull + 0x243564ccb81f3525ull) , (EXP2(64) * 0x5617b61ull + 0xf40cdd7b965d067aull) , },
{
(EXP2(64) * 0x3235f48ull + 0x842d1d9a319126b9ull) , (EXP2(64) * 0xc5a0dfull + 0x36fe8a70737b4e78ull) , (EXP2(64) * 0x3ba8804ull + 0x306c30adf9766aa4ull) , },
{
(EXP2(64) * 0x12e64bdull + 0xf07c510705204d1bull) , (EXP2(64) * 0x50a8deull + 0x49e443318f5390eull) , (EXP2(64) * 0x672f969ull + 0x3e1c381bf5a7aff8ull) , },
{
(EXP2(64) * 0x3f8e2caull + 0xf78f8c8dedc56ce1ull) , (EXP2(64) * 0x1dbb934ull + 0xc0c683f43a225540ull) , (EXP2(64) * 0x279fb67ull + 0xcef4aee5f878aea6ull) , },
{
(EXP2(64) * 0x59f9a2eull + 0xdb4d62180804530full) , (EXP2(64) * 0x5860e73ull + 0x1143b68b4af3e660ull) , (EXP2(64) * 0x6d5a0b7ull + 0x49bd0cf2db6eb8a9ull) , },
{
(EXP2(64) * 0x54fd3b8ull + 0x389c063fe9487bb5ull) , (EXP2(64) * 0x5378175ull + 0x783a5f56eb7feb07ull) , (EXP2(64) * 0x3c719daull + 0xe77a2e738da57158ull) , },
{
(EXP2(64) * 0x1c78b42ull + 0x120b3f7115f2cbd9ull) , (EXP2(64) * 0x1476a84ull + 0xe4aa1cf483bf9725ull) , (EXP2(64) * 0x1d81558ull + 0x53175e0a95a36264ull) , },
{
(EXP2(64) * 0x25293d5ull + 0xd3c38317d1c75e56ull) , (EXP2(64) * 0x103fee0ull + 0xe58bc51d3277db04ull) , (EXP2(64) * 0x517d46cull + 0x8f218904c229def2ull) , },
{
(EXP2(64) * 0x755142dull + 0x1280d651aeb5ffb3ull) , (EXP2(64) * 0x2ff9a9eull + 0xea4623bcaba4aaaaull) , (EXP2(64) * 0x1c12a9cull + 0x456c57e8c9493e4aull) , },
{
(EXP2(64) * 0x315843aull + 0x65b63416445340b0ull) , (EXP2(64) * 0x2ae6c1ull + 0x302a6aa88eb782dcull) , (EXP2(64) * 0xd843ecull + 0xede4f5bbf0002ca4ull) , },
{
(EXP2(64) * 0x1946c6ull + 0x9acf5951ca709fb2ull) , (EXP2(64) * 0x5cc5c33ull + 0x3a8234b0d93f4c12ull) , (EXP2(64) * 0x4df084full + 0x7c13632b0c4ea97aull) , },
{
(EXP2(64) * 0x47e9ac9ull + 0xd595aefad37aad08ull) , (EXP2(64) * 0x62170f5ull + 0x11e552db65c3ea5bull) , (EXP2(64) * 0x79c7de8ull + 0x4a0525c7ff3f2c58ull) , },
{
(EXP2(64) * 0xdf694eull + 0xd8f988f37935a930ull) , (EXP2(64) * 0x25cfc7eull + 0x3979736bc32d82b2ull) , (EXP2(64) * 0x14ac1d4ull + 0x915e0edb809cecc7ull) , },
{
(EXP2(64) * 0x1d0dacdull + 0x71657ccc00af0b18ull) , (EXP2(64) * 0xb67ddeull + 0xbe28b9c03018fc19ull) , (EXP2(64) * 0x7ea7200ull + 0x70e3bc41e882db84ull) , },
{
(EXP2(64) * 0x518d094ull + 0xd1bdb674002d1be4ull) , (EXP2(64) * 0x60fd0b4ull + 0x1a95f9f759bd2ab3ull) , (EXP2(64) * 0x406857eull + 0x93409c5615c1aef1ull) , },
{
(EXP2(64) * 0x208b5e7ull + 0xe9f20ce58b36c273ull) , (EXP2(64) * 0x63a9233ull + 0x153f7b7adaa71259ull) , (EXP2(64) * 0x5152094ull + 0xde496839963b944bull) , },
{
(EXP2(64) * 0x116c565ull + 0x1253832772fee5a8ull) , (EXP2(64) * 0x16265dbull + 0xa3deb21498b6c3dcull) , (EXP2(64) * 0x6c96f10ull + 0xcde7efb9fc110fb4ull) , },
{
(EXP2(64) * 0xc763cull + 0xc9f3686df2ea8959ull) , (EXP2(64) * 0x2181e9ull + 0x9ce04c80cf956dfcull) , (EXP2(64) * 0x531a926ull + 0x415606c90754102aull) , },
{
(EXP2(64) * 0x50006c9ull + 0x5542a16704e81f1eull) , (EXP2(64) * 0x4657e0aull + 0xbd21544fe06d7348ull) , (EXP2(64) * 0x19f1d1ull + 0x4a4a3e8dd7a3cccdull) , },
{
(EXP2(64) * 0x7438c86ull + 0xe337b543be13d86eull) , (EXP2(64) * 0x1467bf1ull + 0x8bc9f705d3ab40a3ull) , (EXP2(64) * 0x2d040d7ull + 0xf1dce3ef98d83ab6ull) , },
{
(EXP2(64) * 0x7e93a14ull + 0xfa0e1d73f35a4dacull) , (EXP2(64) * 0x4e9b0faull + 0xdd040e8e7c5d5a67ull) , (EXP2(64) * 0x56c15e1ull + 0x76cc7975e44dd0b9ull) , },
{
(EXP2(64) * 0x1f7da15ull + 0x410cec458bc13b5eull) , (EXP2(64) * 0xf460a1ull + 0xa5e9e7f71d55c103ull) , (EXP2(64) * 0x538f452ull + 0xa4d7006081e47df8ull) , },
{
(EXP2(64) * 0x21e4e14ull + 0xdb3a194d86c2677eull) , (EXP2(64) * 0x1e52ea8ull + 0xd0e58f6348876be1ull) , (EXP2(64) * 0x770c0c8ull + 0xbb1b5350e7f1c6e2ull) , },
{
(EXP2(64) * 0x4fb47d1ull + 0x6fb1d95fc9a4665cull) , (EXP2(64) * 0x576c049ull + 0x53c576fd956deecfull) , (EXP2(64) * 0x5bc12a9ull + 0x90ff9c1fd61dca7dull) , },
{
(EXP2(64) * 0x4a900cbull + 0x2a7900bb042ce468ull) , (EXP2(64) * 0x6b4cd43ull + 0x7383fc8ca153a64aull) , (EXP2(64) * 0x53c5c0cull + 0x5aed71618d61f8ccull) , },
};
const int MDS_N1 = 3;
const int MDS_N2 = 3;
const F MDS[3][3] = {
{
(EXP2(64) * 0x541fb0dull + 0xe3f45af44d04a98eull) , (EXP2(64) * 0x502de3aull + 0x9830230773878d12ull) , (EXP2(64) * 0x6b03978ull + 0xe91ec27d54c56891ull) , },
{
(EXP2(64) * 0x4b29560ull + 0x466d09faa10235d6ull) , (EXP2(64) * 0x4939a56ull + 0xd887f0e6d8bb9e48ull) , (EXP2(64) * 0x6870d1cull + 0xb933fbc91a006b57ull) , },
{
(EXP2(64) * 0x36c2047ull + 0x4af2ece56ef372b8ull) , (EXP2(64) * 0x64832d2ull + 0xac0932f8d64a553bull) , (EXP2(64) * 0x56f8b84ull + 0xfa114a2f0618945full) , },
};