Functions for serializing and deserializing elements.
int element_length_in_bytes(element_t e)-
Returns the length in bytes the element
ewill take to represent int element_to_bytes(unsigned char *data,element_t e)-
Converts
eto byte, writing the result in the bufferdata. The number of bytes it will write can be determined from callingelement_length_in_bytes(). Returns number of bytes written. int element_from_bytes(element_t e,unsigned char *data)-
Reads
efrom the bufferdata, and returns the number of bytes read. int element_to_bytes_x_only(unsigned char *data,element_t e)-
Assumes
eis a point on an elliptic curve. Writes the x-coordinate ofeto the bufferdata int element_from_bytes_x_only(element_t e,unsigned char *data)-
Assumes
eis a point on an elliptic curve. Setseto a point with x-coordinate represented by the bufferdata. This is not unique. For eachx-coordinate, there exist two different points, at least for the elliptic curves in PBC. (They are inverses of each other.) int element_length_in_bytes_x_only(element_t e)-
Assumes
eis a point on an elliptic curve. Returns the length in bytes needed to hold the x-coordinate ofe. int element_to_bytes_compressed(unsigned char *data,element_t e)-
If possible, outputs a compressed form of the element
eto the buffer of bytesdata. Currently only implemented for points on an elliptic curve. int element_from_bytes_compressed(element_t e,unsigned char *data)-
Sets element
eto the element in compressed form in the buffer of bytesdata. Currently only implemented for points on an elliptic curve. int element_length_in_bytes_compressed(element_t e)-
Returns the number of bytes needed to hold
ein compressed form. Currently only implemented for points on an elliptic curve.