Struct rsa_cortex_m4::F4[][src]

pub struct F4 {}

The fourth Fermat prime, $2^{16} + 1$ (used as public exponent $e$).

This library only implements RSA keys with public exponent e = 65537 = 0x10001 = u16::MAX + 2.

An example recommendation to do so is RFC 4871: https://www.ietf.org/rfc/rfc4871.txt, more generally, there seems no need to have too many knobs to turn.

Implementations

impl F4[src]

pub const DIGIT: Digit[src]

pub const SHORT: Short<1>[src]

NOTE!!! F4 is not convenient, it's only a 17-bit number, whereas Convenient<1, 0> would mean either 31-bit or 63-bit.

pub const PRIME: Prime<1, 0>[src]

pub fn minus_one() -> Short<1>[src]

pub fn prime() -> Prime<1, 0>[src]

pub fn wrapping_inv<const D: usize, const E: usize>() -> Unsigned<D, E>[src]

pub fn inv_mod<const D: usize>(p: &Unsigned<D, 0>) -> Odd<D, 0>[src]

The inverse of $F4$ modulo other primes is used in RSA, and deserves an optimized implementation.

This is Arazi's lemma.

TODO: Prove (disprove?) that calculating the inverse of p_mod_e via PrimeModular's inversion is valid, as F4 is not actually "convenient".

N.B.: We do have a test that the inverse is correct (see test inv_mod_e).

Auto Trait Implementations

impl Send for F4[src]

impl Sync for F4[src]

impl Unpin for F4[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.