ATmega644 Smart-Card
Static Public Member Functions | Private Member Functions | Static Private Attributes | List of all members
AESMath Class Reference

Class providing some mathematical functions needed for AES. More...

#include <aesMath.h>

Collaboration diagram for AESMath:
Collaboration graph

Static Public Member Functions

static void reverseArray (uint8_t arr[], uint8_t low, uint8_t high)
 Reverse an array by swapping the lowest and highest element. More...
 
static void swap (uint8_t &a, uint8_t &b)
 Swap the values of 2 integers. More...
 
static void rightRotateArray (uint8_t arr[], uint8_t n, uint8_t k)
 Rotate an array arr of length n by k to the right. More...
 
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. More...
 

Private Member Functions

 AESMath ()=default
 Construct a new AESMath object.
 

Static Private Attributes

static constexpr uint8_t IRREDUCIBLE_POLYNOMIAL = 0x1B
 Irreducible polynomial: x^8 + x^4 + x^3 + x + 1.
 

Detailed Description

Class providing some mathematical functions needed for AES.

Authors
Philipp Karg (phili.nosp@m.pp.k.nosp@m.arg@t.nosp@m.um.d.nosp@m.e)
Date
02.07.2022

Member Function Documentation

◆ ffMul()

static uint8_t AESMath::ffMul ( uint8_t  x,
uint8_t  y 
)
static

Multiply x and y in GF(2^8) Implemented after https://en.wikipedia.org/wiki/Finite_field_arithmetic.

Parameters
[in]x(uint8_t): Left parameter to multiply.
[in]y(uint8_t): Right parameter to multiply.
Returns
(uint8_t): The result of the Finite-Field multiplication.

◆ reverseArray()

static void AESMath::reverseArray ( uint8_t  arr[],
uint8_t  low,
uint8_t  high 
)
static

Reverse an array by swapping the lowest and highest element.

Parameters
[in,out]arr(uint8_t[]): Array to reverse.
[in]low(uint8_t): Index of the lowest element.
[in]high(uint8_t): Index of the highest element.

◆ rightRotateArray()

static void AESMath::rightRotateArray ( uint8_t  arr[],
uint8_t  n,
uint8_t  k 
)
static

Rotate an array arr of length n by k to the right.

Parameters
[in]arr(uint8_t*): Array to rotate.
[in]n(uint8_t): Length of the array.
[in]k(uint8_t): Amount to rotate.

◆ swap()

static void AESMath::swap ( uint8_t &  a,
uint8_t &  b 
)
static

Swap the values of 2 integers.

Parameters
[in,out]a(uint8_t): First element to swap.
[in,out]b(uint8_t): Second element to swap.

The documentation for this class was generated from the following file: