Add bytes_from_bls_field to interface

This commit is contained in:
Ramana Kumar 2022-10-07 00:28:20 +01:00
parent d453296005
commit 6083d09d29
No known key found for this signature in database
GPG Key ID: ED471C788B900433
2 changed files with 5 additions and 1 deletions

View File

@ -769,6 +769,9 @@ void uint64s_from_BLSFieldElement(uint64_t out[4], const BLSFieldElement *in) {
blst_uint64_from_fr(out, in);
}
void bytes_from_bls_field(uint8_t out[32], const BLSFieldElement *in) {
blst_scalar_from_fr((blst_scalar*)out, in);
}
C_KZG_RET load_trusted_setup(KZGSettings *out, FILE *in) {
uint64_t n2, i;

View File

@ -61,10 +61,11 @@ C_KZG_RET bytes_to_g1(g1_t* out, const uint8_t[48]);
* BLSFieldElements are communicated directly to/from clients,
* so we need to expose the functions for translating between this
* type and uint256. BLST represents uint256 as uint64[4].
* TODO: we should perhaps just used bytes[32] for this too.
* TODO: remove the uint64s version?
* For conversion to BLSFieldElement use bytes_to_bls_field.
*/
void uint64s_from_BLSFieldElement(uint64_t out[4], const BLSFieldElement*);
void bytes_from_bls_field(uint8_t out[32], const BLSFieldElement*);
/**
* Stores the setup and parameters needed for performing FFTs.