diff options
| author | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2018-12-11 17:15:39 +0100 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2018-12-11 17:20:37 +0100 |
| commit | dc8035fc0b4d12d999a053de90071143bcd9b12d (patch) | |
| tree | 3dfb72cb93e74198f0d705e486d6bcd3a7f30b6b /src | |
| parent | 54f6df2a5f97bb82aa9240e3bbf44c91410ce410 (diff) | |
| download | lilliput-ae-implem-dc8035fc0b4d12d999a053de90071143bcd9b12d.tar.xz | |
Renommage des séquences
En fait les séquences marchent dans un sens comme dans l'autre.
✨ MathéMagie ✨
Diffstat (limited to 'src')
| -rw-r--r-- | src/tweakey.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/tweakey.c b/src/tweakey.c index 5401e7d..dd0a855 100644 --- a/src/tweakey.c +++ b/src/tweakey.c @@ -55,7 +55,7 @@ static void _multiply_M(const uint8_t X[LANE_BYTES], uint8_t Y[LANE_BYTES]) Y[0] = X[7]; } -static const uint8_t M_M1[256] = { +static const uint8_t M1[256] = { 0x00, 0x08, 0x10, 0x18, 0x20, 0x28, 0x30, 0x38, 0x41, 0x49, 0x51, 0x59, 0x61, 0x69, 0x71, 0x79, 0x82, 0x8a, 0x92, 0x9a, 0xa2, 0xaa, 0xb2, 0xba, @@ -90,7 +90,7 @@ static const uint8_t M_M1[256] = { 0xdf, 0xd7, 0xcf, 0xc7, 0xff, 0xf7, 0xef, 0xe7 }; -static const uint8_t M_M2[256] = { +static const uint8_t M2[256] = { 0x00, 0x40, 0x80, 0xc0, 0x00, 0x40, 0x80, 0xc0, 0x08, 0x48, 0x88, 0xc8, 0x08, 0x48, 0x88, 0xc8, 0x10, 0x50, 0x90, 0xd0, 0x10, 0x50, 0x90, 0xd0, @@ -129,7 +129,7 @@ static void _multiply_M2(const uint8_t X[LANE_BYTES], uint8_t Y[LANE_BYTES]) { Y[7] = X[5]; Y[6] = X[4] ^ X[5]<<3; - Y[5] = X[3] ^ M_M1[X[4]] ^ X[5]<<6; + Y[5] = X[3] ^ M1[X[4]] ^ X[5]<<6; Y[4] = X[2] ^ X[3]>>3 ^ X[4]>>6; Y[3] = X[6]<<2 ^ X[1]; Y[2] = X[5]<<2 ^ X[0]; @@ -139,17 +139,17 @@ static void _multiply_M2(const uint8_t X[LANE_BYTES], uint8_t Y[LANE_BYTES]) static void _multiply_M3(const uint8_t X[LANE_BYTES], uint8_t Y[LANE_BYTES]) { - Y[7] = X[5]<<3 ^ X[4]; - Y[6] = X[5]<<6 ^ M_M1[X[4]] ^ X[3]; - Y[5] = M_M2[X[4]] ^ M_M1[X[3]] ^ X[2]; - Y[4] = X[6]<<2 ^ X[3]>>6 ^ X[2]>>3 ^ X[1]; - Y[3] = X[5]<<2 ^ X[0]; - Y[2] = X[7] ^ X[5]<<5 ^ X[4]<<2; + Y[7] = X[5]<<3 ^ X[4]; + Y[6] = X[5]<<6 ^ M1[X[4]] ^ X[3]; + Y[5] = M2[X[4]] ^ M1[X[3]] ^ X[2]; + Y[4] = X[6]<<2 ^ X[3]>>6 ^ X[2]>>3 ^ X[1]; + Y[3] = X[5]<<2 ^ X[0]; + Y[2] = X[7] ^ X[5]<<5 ^ X[4]<<2; Y[1] = X[6]; Y[0] = X[5]; } -static const uint8_t MR_M3[256] = { +static const uint8_t M3[256] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, @@ -200,7 +200,7 @@ static void _multiply_MR2(const uint8_t X[LANE_BYTES], uint8_t Y[LANE_BYTES]) { Y[0] = X[2]; Y[1] = X[3] ^ X[4]>>3; - Y[2] = X[4] ^ X[5]>>3 ^ MR_M3[X[6]]; + Y[2] = X[4] ^ X[5]>>3 ^ M3[X[6]]; Y[3] = X[5] ^ X[6]<<3; Y[4] = X[3]<<2 ^ X[6] ^ X[7]<<3; Y[5] = X[4]<<2 ^ X[7]; |
