RustCrypto / crypto-bigint

Cryptography-oriented big integer library with constant-time, stack-allocated (no_std-friendly) implementations of modern formulas
Apache License 2.0
182 stars 51 forks source link

Implement serde for `Odd` #604

Closed dvdplm closed 3 months ago

dvdplm commented 3 months ago

Most other wrapper types implement serde, e.g. NonZero and Wrapping. This PR implements it for Odd as well.

One oddity I noticed when writing the tests was that deserializing a bigger Uint into a smaller one does not return an error. Instead the original value seems to be truncated to fit the smaller type. Is that the expected behaviour?