Point

Struct Point 

Source
pub struct Point { /* private fields */ }

Implementations§

Source§

impl Point

Source

pub fn new() -> Self

Trait Implementations§

Source§

impl BinaryMarshaler for Point

Source§

impl BinaryUnmarshaler for Point

Source§

impl Clone for Point

Source§

fn clone(&self) -> Point

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Point

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Point

Source§

fn default() -> Point

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Point

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Point

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Point

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl LowerHex for Point

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Marshaling for Point

Source§

fn marshal_to(&self, w: &mut impl Write) -> Result<(), MarshallingError>

Encode the contents of this object and write it to an io::Write.
Source§

fn marshal_size(&self) -> usize

Encoded length of this object in bytes.
Source§

fn unmarshal_from(&mut self, r: &mut impl Read) -> Result<(), MarshallingError>

Decode the content of this object by reading from a io::Read. If r is an [XOF], it uses r to pick a valid object pseudo-randomly, which may entail reading more than len bytes due to retries.
Source§

fn unmarshal_from_random(&mut self, r: &mut (impl Read + Stream))

Source§

fn marshal_id(&self) -> [u8; 8]

[marshal_id()] returns the type tag used in encoding/decoding
Source§

impl Ord for Point

Source§

fn cmp(&self, other: &Point) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Point

Source§

fn eq(&self, p2: &Self) -> bool

[eq()] is an equality test for two points on the same curve

1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Point

Source§

fn partial_cmp(&self, other: &Point) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Point for Point

Source§

fn null(self) -> Self

[null()] sets [self] to the neutral element, which is (0,1) for twisted Edwards curves.

Source§

fn base(self) -> Self

[base()] sets [self] to the standard base point for this curve

Source§

fn mul(self, s: &Scalar, p: Option<&Self>) -> Self

[mul()] multiplies Point p by Scalar s using the repeated doubling method.

Source§

type SCALAR = Scalar

Source§

fn pick<S: Stream>(self, rand: &mut S) -> Self

[pick()] sets the receiver to a fresh random or pseudo-random Point.
Source§

fn set(&mut self, p: &Self) -> Self

[set()] sets the receiver equal to another Point p.
Source§

fn embed_len(&self) -> usize

[embed_len()] returns the maximum number of bytes that can be embedded in a single group element via [pick()].
Source§

fn embed<S: Stream>(self, data: Option<&[u8]>, rand: &mut S) -> Self

[embed()] encodes a limited amount of specified data in the Point, using r as a source of cryptographically secure random data. Implementations only embed the first embed_len bytes of the given data.
Source§

fn data(&self) -> Result<Vec<u8>, PointError>

[data()] extracts data embedded in a Point chosen via [embed()]. Returns an Error if doesn’t represent valid embedded data.
Source§

fn add(self, p1: &Self, p2: &Self) -> Self

[add()] adds points so that their scalars add homomorphically.
Source§

fn sub(self, p1: &Self, p2: &Self) -> Self

[sub()] subtracts points so that their scalars subtract homomorphically.
Source§

fn neg(&mut self, a: &Self) -> Self

Set to the negation of point a.
Source§

impl PointCanCheckCanonicalAndSmallOrder for Point

Source§

fn has_small_order(&self) -> bool

[has_small_order()] determines whether the group element has small order

Provides resilience against malicious key substitution attacks (M-S-UEO) and message bound security (MSB) even for malicious keys See paper https://eprint.iacr.org/2020/823.pdf for definitions and theorems

This is the same code as in https://github.com/jedisct1/libsodium/blob/4744636721d2e420f8bbe2d563f31b1f5e682229/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c#L1170

Source§

fn is_canonical(&self, b: &[u8]) -> bool

[is_canonical()] determines whether the group element is canonical

Checks whether group element s is less than p, according to RFC8032§5.1.3.1 https://tools.ietf.org/html/rfc8032#section-5.1.3

Taken from https://github.com/jedisct1/libsodium/blob/4744636721d2e420f8bbe2d563f31b1f5e682229/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c#L1113

The method accepts a buffer instead of calling marshal_binary() on the receiver because that always returns a value modulo prime.

Source§

impl Serialize for Point

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl UpperHex for Point

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for Point

Source§

impl Eq for Point

Auto Trait Implementations§

§

impl Freeze for Point

§

impl RefUnwindSafe for Point

§

impl Send for Point

§

impl Sync for Point

§

impl Unpin for Point

§

impl UnwindSafe for Point

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,