pub struct Curve { /* private fields */ }Expand description
Domain parameters of a short Weierstrass curve y² = x³ + a·x + b over a prime field.
The curve module has the common curves. Use Curve::new for any other.
Implementations§
Source§impl Curve
impl Curve
Sourcepub const fn new(
p: &'static [u8],
a: &'static [u8],
b: &'static [u8],
gx: &'static [u8],
gy: &'static [u8],
n: &'static [u8],
) -> Self
pub const fn new( p: &'static [u8], a: &'static [u8], b: &'static [u8], gx: &'static [u8], gy: &'static [u8], n: &'static [u8], ) -> Self
Builds a curve from its domain parameters.
All values are big-endian and must have the same length:
p: the field modulus.a,b: the curve coefficients.gx,gy: the coordinates of the generator.n: the order of the generator. Pad it with zeros on the left if it is shorter than the field.
§Panics
Panics if the values do not all have the same length, or if that length is larger than
MAX_CURVE_LEN.
Sourcepub const fn size(&self) -> usize
pub const fn size(&self) -> usize
Length in bytes of a coordinate, a scalar or a signature component on this curve.
Sourcepub const fn order_bits(&self) -> u32
pub const fn order_bits(&self) -> u32
Length in bits of the order of the generator.
Sourcepub const fn field_bits(&self) -> u32
pub const fn field_bits(&self) -> u32
Length in bits of the field modulus.
Sourcepub const fn n_bytes(&self) -> &'static [u8]
pub const fn n_bytes(&self) -> &'static [u8]
The order of the generator, big-endian and Curve::size bytes long.
Scalars, private keys and signature components must be nonzero and smaller than this.
Auto Trait Implementations§
impl Freeze for Curve
impl RefUnwindSafe for Curve
impl Send for Curve
impl Sync for Curve
impl Unpin for Curve
impl UnsafeUnpin for Curve
impl UnwindSafe for Curve
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more