AES-DH Implementation
Loading...
Searching...
No Matches
aes::gf Namespace Reference

Helper utilities for working within a Galois Field 2**8. More...

Functions

uint8_t mult (uint8_t a, uint8_t b)
 Multiply two bytes in GA(256)
 
uint8_t inverse (uint8_t a)
 Find the Multiplicative Inverse of a byte in GF(2**8)
 

Detailed Description

Helper utilities for working within a Galois Field 2**8.

Function Documentation

◆ inverse()

uint8_t aes::gf::inverse ( uint8_t a)

Find the Multiplicative Inverse of a byte in GF(2**8)

Parameters
aThe value to find the inverse of.
Remarks
There are much more efficient ways to do this (Primarily just forgoing any explicit algorithm and just using a precomputed table), But for the sake of simplicity (And since there's only 256 values to check), We can just brute force it by checking against every value.

◆ mult()

uint8_t aes::gf::mult ( uint8_t a,
uint8_t b )

Multiply two bytes in GA(256)

Parameters
aThe first byte.
bThe second byte.
Note
From https://gist.github.com/meagtan/dc1adff8d84bb895891d8fd027ec9d8c
Remarks
Most implementations would avoid this, and simply compute a 256x256 lookup table containing all values, like how SubBytes works.