Definition of Fp math. More...
Functions | |
int | FpInField (FpElem const *in) |
Test if an element is in Fp. More... | |
void | FpAdd (FpElem *result, FpElem const *left, FpElem const *right) |
Add two elements of Fp. More... | |
void | FpMul (FpElem *result, FpElem const *left, FpElem const *right) |
Multiply two elements of Fp. More... | |
void | FpSub (FpElem *result, FpElem const *left, FpElem const *right) |
Subtract two elements of Fp. More... | |
void | FpExp (FpElem *result, FpElem const *base, VeryLargeInt const *exp) |
Exponentiate an element of Fp by a large integer. More... | |
void | FpNeg (FpElem *result, FpElem const *in) |
Negate an element of Fp. More... | |
int | FpEq (FpElem const *left, FpElem const *right) |
Test if two elements in Fp are equal. More... | |
void | FpInv (FpElem *result, FpElem const *in) |
Invert an element of Fp. More... | |
int | FpRand (FpElem *result, BitSupplier rnd_func, void *rnd_param) |
Generate a random element of Fp. More... | |
int | FpRandNonzero (FpElem *result, BitSupplier rnd_func, void *rnd_param) |
Generate a non-zero random element of Fp. More... | |
void | FpClear (FpElem *result) |
Clear an element of Fp. More... | |
void | FpSet (FpElem *result, uint32_t in) |
Set a element of Fp's value. More... | |
void | FpFromHash (FpElem *result, unsigned char const *hash, size_t len) |
Reinterpret a buffer as an element of Fp. More... | |
Definition of Fp math.
Add two elements of Fp.
[out] | result | of adding left and right. |
[in] | left | The first operand to be added. |
[in] | right | The second operand to be added. |
void FpClear | ( | FpElem * | result | ) |
Clear an element of Fp.
[out] | result | value to clear. |
Test if two elements in Fp are equal.
[in] | left | The first operand to be tested. |
[in] | right | The second operand to be tested. |
void FpExp | ( | FpElem * | result, |
FpElem const * | base, | ||
VeryLargeInt const * | exp | ||
) |
Exponentiate an element of Fp by a large integer.
[out] | result | target. |
[in] | base | the base. |
[in] | exp | the exponent. |
void FpFromHash | ( | FpElem * | result, |
unsigned char const * | hash, | ||
size_t | len | ||
) |
Reinterpret a buffer as an element of Fp.
[out] | result | target. |
[in] | hash | buffer to reinterpret. |
[in] | len | length of hash in bytes. |
int FpInField | ( | FpElem const * | in | ) |
Test if an element is in Fp.
[in] | in | the element to test |
Invert an element of Fp.
[out] | result | target. |
[in] | in | the value to invert. |
Multiply two elements of Fp.
[out] | result | of multiplying left and right. |
[in] | left | The first operand to be multiplied. |
[in] | right | The second operand to be multiplied. |
Negate an element of Fp.
[out] | result | target. |
[in] | in | the value to negate. |
int FpRand | ( | FpElem * | result, |
BitSupplier | rnd_func, | ||
void * | rnd_param | ||
) |
Generate a random element of Fp.
[in] | result | the random value. |
[in] | rnd_func | Random number generator. |
[in] | rnd_param | Pass through context data for rnd_func. |
int FpRandNonzero | ( | FpElem * | result, |
BitSupplier | rnd_func, | ||
void * | rnd_param | ||
) |
Generate a non-zero random element of Fp.
[in] | result | the random value. |
[in] | rnd_func | Random number generator. |
[in] | rnd_param | Pass through context data for rnd_func. |
void FpSet | ( | FpElem * | result, |
uint32_t | in | ||
) |
Set a element of Fp's value.
[out] | result | target. |
[in] | in | value to set. |