I’m working on an implementation of a Galois field for a cryptographic library.
I would like to have precomputed tables for operations in Gf(256).
Existing implementations either use
ONCE_INIT to generate the table when the program launches or have the table hardcoded in the source code.
I’m trying to generate the table (implemented as a
struct) at compile time elegantly without having to hardcode it. I have looked into using macros but it appears that they alone won’t be able to provide the operations I need to compute the table.
I started looking into compiler plugins, is that the right tool for the job? Or anyone has an alternative that wouldn’t require me to move to experimental versions of the compiler?