Struct chain_crypto::ec::ristretto255::Scalar
source · pub struct Scalar(Scalar);
Tuple Fields§
§0: Scalar
Implementations§
source§impl Scalar
impl Scalar
pub const BYTES_LEN: usize = 32usize
pub fn negate(&self) -> Self
pub fn to_bytes(&self) -> [u8; 32]
pub fn as_bytes(&self) -> &[u8] ⓘ
sourcepub fn from_bytes(slice: &[u8]) -> Option<Self>
pub fn from_bytes(slice: &[u8]) -> Option<Self>
Returns none if slice is not canonical
pub fn hash_to_scalar(b: &Blake2b) -> Scalar
pub fn random<R: RngCore + CryptoRng>(rng: &mut R) -> Self
pub fn from_u64(v: u64) -> Self
sourcepub fn power(&self, n: usize) -> Self
pub fn power(&self, n: usize) -> Self
Raises x
to the power n
using binary exponentiation,
with (1 to 2)*lg(n) scalar multiplications.
Not constant time
pub fn sum<I>(i: I) -> Option<Self>where I: Iterator<Item = Self>,
Trait Implementations§
source§impl<'a, 'b> Mul<&'b GroupElement> for &'a Scalar
impl<'a, 'b> Mul<&'b GroupElement> for &'a Scalar
§type Output = GroupElement
type Output = GroupElement
The resulting type after applying the
*
operator.source§fn mul(self, other: &'b GroupElement) -> GroupElement
fn mul(self, other: &'b GroupElement) -> GroupElement
Performs the
*
operation. Read moresource§impl<'b> Mul<&'b GroupElement> for Scalar
impl<'b> Mul<&'b GroupElement> for Scalar
§type Output = GroupElement
type Output = GroupElement
The resulting type after applying the
*
operator.source§impl<'a, 'b> Mul<&'b Scalar> for &'a GroupElement
impl<'a, 'b> Mul<&'b Scalar> for &'a GroupElement
§type Output = GroupElement
type Output = GroupElement
The resulting type after applying the
*
operator.source§impl<'b> Mul<&'b Scalar> for GroupElement
impl<'b> Mul<&'b Scalar> for GroupElement
source§impl<'a> Mul<GroupElement> for &'a Scalar
impl<'a> Mul<GroupElement> for &'a Scalar
§type Output = GroupElement
type Output = GroupElement
The resulting type after applying the
*
operator.source§impl Mul<GroupElement> for Scalar
impl Mul<GroupElement> for Scalar
§type Output = GroupElement
type Output = GroupElement
The resulting type after applying the
*
operator.source§impl<'a> Mul<Scalar> for &'a GroupElement
impl<'a> Mul<Scalar> for &'a GroupElement
source§impl Mul<Scalar> for GroupElement
impl Mul<Scalar> for GroupElement
source§impl PartialEq<Scalar> for Scalar
impl PartialEq<Scalar> for Scalar
impl Eq for Scalar
impl StructuralEq for Scalar
impl StructuralPartialEq for Scalar
Auto Trait Implementations§
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