[][src]Trait pq_newhope::Pke

pub trait Pke {
    type Seed: ArrayLength<u8>;
    type GenerationSeed: ArrayLength<u8>;
    type Plain: ArrayLength<u8>;
    type Cipher: ArrayLength<u8>;
    type PublicKey: LineValid;
    type SecretKey: LineValid;
    fn new(seed: &GenericArray<u8, Self::Seed>) -> Self;
fn generate(
        &self,
        seed: &GenericArray<u8, Self::GenerationSeed>
    ) -> (Self::PublicKey, Self::SecretKey);
fn encrypt(
        &self,
        seed: &GenericArray<u8, Self::GenerationSeed>,
        pk_a: &Self::PublicKey,
        plain: &GenericArray<u8, Self::Plain>
    ) -> (Self::PublicKey, GenericArray<u8, Self::Cipher>);
fn decrypt(
        pk_b: &Self::PublicKey,
        sk_a: &Self::SecretKey,
        cipher: &GenericArray<u8, Self::Cipher>
    ) -> GenericArray<u8, Self::Plain>; }

Associated Types

type Seed: ArrayLength<u8>

type GenerationSeed: ArrayLength<u8>

type Plain: ArrayLength<u8>

type Cipher: ArrayLength<u8>

type PublicKey: LineValid

type SecretKey: LineValid

Loading content...

Required methods

fn new(seed: &GenericArray<u8, Self::Seed>) -> Self

fn generate(
    &self,
    seed: &GenericArray<u8, Self::GenerationSeed>
) -> (Self::PublicKey, Self::SecretKey)

fn encrypt(
    &self,
    seed: &GenericArray<u8, Self::GenerationSeed>,
    pk_a: &Self::PublicKey,
    plain: &GenericArray<u8, Self::Plain>
) -> (Self::PublicKey, GenericArray<u8, Self::Cipher>)

fn decrypt(
    pk_b: &Self::PublicKey,
    sk_a: &Self::SecretKey,
    cipher: &GenericArray<u8, Self::Cipher>
) -> GenericArray<u8, Self::Plain>

Loading content...

Implementors

impl<N> Pke for Parameter<N> where
    N: PolySize,
    Poly<N, (B0, B1, B1)>: FromSeed,
    Poly<N, (B1, B0, B0)>: FromSeedSmall + Ntt<Output = Poly<N, (B0, B0, B1)>>,
    Poly<N, (B0, B0, B1)>: Ntt + ReverseBits<Output = Poly<N, (B1, B0, B1)>>,
    Poly<N, (B1, B0, B1)>: Ntt<Output = Poly<N, (B0, B0, B0)>> + ReverseBits,
    Poly<N, (B0, B0, B0)>: FromSeed + Ntt
[src]

type Seed = U32

type GenerationSeed = U32

type Plain = U32

type Cipher = N::CompressedLength

type PublicKey = PublicKey<N>

type SecretKey = SecretKey<N>

Loading content...