pub struct Scalar(/* private fields */);
Expand description
sect283k1 scalar value for use in elliptic curve operations
Implementations§
Source§impl Scalar
impl Scalar
Sourcepub fn new(data: [u8; 36]) -> Result<Self>
pub fn new(data: [u8; 36]) -> Result<Self>
Create a new scalar from raw bytes.
The bytes will be reduced modulo the curve order if necessary. The most significant bit is masked to ensure the scalar is < 2^283. Returns an error if the resulting scalar would be zero.
Sourcepub fn from_secret_buffer(
buffer: SecretBuffer<B283K_SCALAR_SIZE>,
) -> Result<Self>
pub fn from_secret_buffer( buffer: SecretBuffer<B283K_SCALAR_SIZE>, ) -> Result<Self>
Create a scalar from a SecretBuffer
.
The buffer contents will be reduced modulo the curve order if necessary. Returns an error if the resulting scalar would be zero.
Sourcepub fn as_secret_buffer(&self) -> &SecretBuffer<B283K_SCALAR_SIZE>
pub fn as_secret_buffer(&self) -> &SecretBuffer<B283K_SCALAR_SIZE>
Get a reference to the underlying SecretBuffer
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Scalar
impl RefUnwindSafe for Scalar
impl Send for Scalar
impl Sync for Scalar
impl Unpin for Scalar
impl UnwindSafe for Scalar
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