pub trait FieldBytesEncoding<C>: ArrayEncoding + Integerwhere
C: Curve,{
// Provided methods
fn decode_field_bytes(field_bytes: &FieldBytes<C>) -> Self { ... }
fn encode_field_bytes(&self) -> FieldBytes<C> { ... }
}
Expand description
Trait for decoding/encoding Curve::Uint
from/to FieldBytes
using
curve-specific rules.
Namely a curve’s modulus may be smaller than the big integer type used to internally represent field elements (since the latter are multiples of the limb size), such as in the case of curves like NIST P-224 and P-521, and so it may need to be padded/truncated to the right length.
Additionally, different curves have different endianness conventions, also captured here.
Provided Methods§
Sourcefn decode_field_bytes(field_bytes: &FieldBytes<C>) -> Self
fn decode_field_bytes(field_bytes: &FieldBytes<C>) -> Self
Decode unsigned integer from serialized field element.
The default implementation assumes a big endian encoding.
Sourcefn encode_field_bytes(&self) -> FieldBytes<C>
fn encode_field_bytes(&self) -> FieldBytes<C>
Encode unsigned integer into serialized field element.
The default implementation assumes a big endian encoding.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.