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

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

Associated Types

type Output

Loading content...

Required methods

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

Performs the Inverse Square root of a given value.

This operation returns always the positive result of the modular sqrt, understanding positive as the definition that appears on the Decaf paper: 0 < result < (P - 1)/2.

Loading content...

Implementors

impl<'_> InvSqrt for &'_ FieldElement[src]

type Output = (Choice, FieldElement)

fn inv_sqrt(self) -> (Choice, FieldElement)[src]

This is a convenience wrapper function over the SqrtRatioI trait implementation when self = 1: Computes sqrt(1/self).

This function always returns the non-negative result of the sqrt.

Returns:

  • (Choice(1), +sqrt(1/self)) if self is a nonzero square;
  • (Choice(0), zero) if self is zero;
  • (Choice(0), +sqrt(i/self)) if self is a nonzero nonsquare;
Loading content...