ATmega644 Smart-Card
Loading...
Searching...
No Matches
aesMath.h
1
11#ifndef AES_MATH_H
12#define AES_MATH_H
13
14#include "defs.h"
15
25{
26public:
33 static void reverseArray(uint8_t arr[], uint8_t low, uint8_t high);
34
40 static void swap(uint8_t &a, uint8_t &b);
41
48 static void rightRotateArray(uint8_t arr[], uint8_t n, uint8_t k);
49
57 static uint8_t ffMul(uint8_t x, uint8_t y);
58private:
59 static constexpr uint8_t IRREDUCIBLE_POLYNOMIAL = 0x1B;
60
64 AESMath() = default;
65};
66
67#endif // AES_MATH_H
Class providing some mathematical functions needed for AES.
Definition aesMath.h:25
static uint8_t ffMul(uint8_t x, uint8_t y)
Multiply x and y in GF(2^8) Implemented after https://en.wikipedia.org/wiki/Finite_field_arithmetic.
AESMath()=default
Construct a new AESMath object.
static void rightRotateArray(uint8_t arr[], uint8_t n, uint8_t k)
Rotate an array arr of length n by k to the right.
static constexpr uint8_t IRREDUCIBLE_POLYNOMIAL
Irreducible polynomial: x^8 + x^4 + x^3 + x + 1.
Definition aesMath.h:59
static void reverseArray(uint8_t arr[], uint8_t low, uint8_t high)
Reverse an array by swapping the lowest and highest element.
static void swap(uint8_t &a, uint8_t &b)
Swap the values of 2 integers.