libdecaf
Functions
f_generic.c File Reference

Generic arithmetic which has to be compiled per field. More...

Functions

void gf_serialize (uint8_t serial[SER_BYTES], const gf x)
 Serialize to wire format. More...
 
mask_t gf_lobit (const gf x)
 Return high bit of x = low bit of 2x mod p.
 
mask_t gf_deserialize (gf x, const uint8_t serial[SER_BYTES], uint8_t hi_nmask)
 Deserialize from wire format; return -1 on success and 0 on failure. More...
 
void gf_strong_reduce (gf a)
 Reduce to canonical form. More...
 
void gf_sub (gf d, const gf a, const gf b)
 Subtract two gf elements d=a-b.
 
void gf_add (gf d, const gf a, const gf b)
 Add two field elements d = a+b.
 
mask_t gf_eq (const gf a, const gf b)
 Compare a==b. More...
 

Detailed Description

Generic arithmetic which has to be compiled per field.

Author
Mike Hamburg
Warning
This file was automatically generated in Python. Please do not edit it.

Function Documentation

◆ gf_deserialize()

mask_t gf_deserialize ( gf  x,
const uint8_t  serial[SER_BYTES],
uint8_t  hi_nmask 
)

Deserialize from wire format; return -1 on success and 0 on failure.

◆ gf_eq()

mask_t gf_eq ( const gf  a,
const gf  b 
)

Compare a==b.

a^2 x = 1, QNR, or 0 if x=0.

◆ gf_serialize()

void gf_serialize ( uint8_t  serial[SER_BYTES],
const gf  x 
)

Serialize to wire format.

◆ gf_strong_reduce()

void gf_strong_reduce ( gf  a)

Reduce to canonical form.