LFDT-Lockness / generic-ec

Generic elliptic curve cryptography in Rust
Apache License 2.0
2 stars 2 forks source link

Address (de)serialization issue #9

Closed survived closed 12 months ago

survived commented 12 months ago

PR changes point/scalar serialization so they always serialize to hex-encoding on human-readable formats even if alloc feature is disabled. However, now there's a limit for the max length of serialized point/scalar of 128 bytes. The limitation can be removed when Rust has better const-generics support. Fixes #8.

Also fixes a freshly discovered bug that library panicked when an identity point is converted to bytes.

survived commented 12 months ago

With better const generics we would just have const UNCOMPRESSED_POINT_SIZE: usize in Curve trait, then for hex-encoding we'd just create a byte array [0u8; 2 * E::UNCOMPRESSED_POINT_SIZE]