CECCO: Basic Usage
CECCO is a header-only library; no installation or compilation is required. Simply include the cecco.hpp header, make sure the compiler can find it using the -I flag, and set the C++ standard with -std=c++20. For clang++ the compile command could be as easy as clang++ -Icecco/ -std=c++20 code.cpp assuming that you did git clone https://github.com/christiansenger/cecco.git.
#include "cecco.hpp"
It often makes sense to bring the CECCO namespace into an appropriate scope. File scope is usually the most convenient:
using namespace CECCO;
CECCO has a couple of global flags that are set through macros (before #include "cecco.hpp"). Erasure support is enabled with
#define CECCO_ERASURE_SUPPORT
Erasure support allows each field element to be set to an out-of-field value represented by an X. Erasure support has a negative effect on performance, so it should only be enabled when necessary.
The following global flags can typically be left unchanged (i.e., undefined).
Prime fields operations, such as those of the binary field, are computed efficiently on the fly using modular arithmetic. In rare cases, it may make sense to use lookup tables instead, which can be achieved with
#define CECCO_USE_LUTS_FOR_FP
It can also make sense to compress larger lookup tables (for extension fields or, if the CECCO_USE_LUTS_FOR_FP macro is defined, also for prime fields). The threshold for when compression is performed is set with
#define CECCO_COMPRESS_LUTS_FROM_Q 128
The default is 65, meaning that fields with 64 or fewer elements use uncompressed lookup tables, while larger fields use compressed ones.
A complete and compilable demo is shown below:
#define CECCO_COMPRESS_LUTS_FROM_Q 128
#define CECCO_USE_LUTS_FOR_FP
#define CECCO_ERASURE_SUPPORT
#include "cecco.hpp"
using namespace CECCO;
int main(void) {
// use CECCO
return 0;
}
