[][src]Trait zerocaf::traits::ops::Square

pub trait Square {
    type Output;
#[must_use]
    fn square(self) -> Self::Output;
}

Trait that represents the ^2 operation for any kind of element on the library.

This trait is implemented following the rules that mandate over the Type that is being implemented.

Associated Types

type Output

Loading content...

Required methods

#[must_use] fn square(self) -> Self::Output

Returns the square of the input: x^2.

Loading content...

Implementors

impl<'a> Square for &'a FieldElement[src]

type Output = FieldElement

fn square(self) -> FieldElement[src]

Compute a^2 (mod l).

This Square implementation returns a double precision result. The result of the standard square is stored on a [u128; 9].

Then, we apply the Montgomery Reduction function to perform the modulo and the reduction to the FieldElement format: [u64; 5].

impl<'a> Square for &'a Scalar[src]

type Output = Scalar

fn square(self) -> Scalar[src]

This Square implementation returns a double precision result. The result of the standard mul is stored on a [u128; 9].

Then, we apply the Montgomery Reduction function to perform the modulo and the reduction to the Scalar format: [u64; 5].

Loading content...