herumi / mcl

a portable and fast pairing-based cryptography library
BSD 3-Clause "New" or "Revised" License
452 stars 152 forks source link

big endian save&load #26

Closed fionser closed 5 years ago

fionser commented 5 years ago

Any (easy) way to change littlte endian to big endian when doing serialization.

herumi commented 5 years ago

Is it about Fp? There is no way to do so now.

Scratch-net commented 5 years ago

@herumi Is the serialization format for BN, G1, G2, GT compatible with Relic? I'd like to move to MCL instead of relic but I need data to look as it is now. Is it possible to convert if not?

herumi commented 5 years ago

I don't know Relic's format. How do you convert it? Do you import the binary data exported from Relic to mcl?

Scratch-net commented 5 years ago

I don't convert it (yet) I just wanted to figure out if it's possible. I use functions g1_write_bin, g2_write_bin, etc

https://github.com/relic-toolkit/relic/blob/086643803fc64bb109112b16160cb5c8a7ab5e66/src/ep/relic_ep_util.c#L310

https://github.com/relic-toolkit/relic/blob/086643803fc64bb109112b16160cb5c8a7ab5e66/src/epx/relic_ep2_util.c

https://github.com/relic-toolkit/relic/blob/086643803fc64bb109112b16160cb5c8a7ab5e66/src/fpx/relic_fpx_util.c#L90

herumi commented 5 years ago

@Scratch-net mcl supports Affine/Jacobi coordinate. After generating (x, y) by Relic and could you set it to mcl?

Scratch-net commented 5 years ago

Haven't tried that, I need to check and get back to you.