Add fr_to_uint64s() function

This commit is contained in:
Anton Nashatyrev 2021-07-02 14:48:36 +03:00
parent ba81164330
commit fc641a2197
2 changed files with 11 additions and 0 deletions

View File

@ -121,6 +121,16 @@ void fr_from_uint64(fr_t *out, uint64_t n) {
fr_from_uint64s(out, vals); fr_from_uint64s(out, vals);
} }
/**
* Convert the field element to an array of four 64-bit unsigned integers.
*
* @param out array for returned values, little-endian ordering of the 64-bit words
* @param vals The field element equivalent of @p n
*/
void fr_to_uint64s(uint64_t out[4], const fr_t* fr) {
blst_uint64_from_fr(out, fr);
}
/** /**
* Test whether two field elements are equal. * Test whether two field elements are equal.
* *

View File

@ -104,6 +104,7 @@ bool fr_is_null(const fr_t *p);
void fr_from_scalar(fr_t *out, const scalar_t *a); void fr_from_scalar(fr_t *out, const scalar_t *a);
void fr_from_uint64s(fr_t *out, const uint64_t *vals); void fr_from_uint64s(fr_t *out, const uint64_t *vals);
void fr_from_uint64(fr_t *out, uint64_t n); void fr_from_uint64(fr_t *out, uint64_t n);
void fr_to_uint64s(uint64_t out[4], const fr_t* fr);
bool fr_equal(const fr_t *aa, const fr_t *bb); bool fr_equal(const fr_t *aa, const fr_t *bb);
void fr_negate(fr_t *out, const fr_t *in); void fr_negate(fr_t *out, const fr_t *in);
void fr_add(fr_t *out, const fr_t *a, const fr_t *b); void fr_add(fr_t *out, const fr_t *a, const fr_t *b);