pub trait PSF {
type A;
type Trapdoor;
type Domain;
type Range;
// Required methods
fn trap_gen(&self) -> (Self::A, Self::Trapdoor);
fn samp_d(&self) -> Self::Domain;
fn samp_p(
&self,
a: &Self::A,
r: &Self::Trapdoor,
u: &Self::Range,
) -> Self::Domain;
fn f_a(&self, a: &Self::A, sigma: &Self::Domain) -> Self::Range;
fn check_domain(&self, sigma: &Self::Domain) -> bool;
}Expand description
This trait should be implemented by all constructions that are actual implementations of a preimage sampleable function. A formal definition for these PSFs can be found in [1]
Required Associated Types§
Required Methods§
Sourcefn trap_gen(&self) -> (Self::A, Self::Trapdoor)
fn trap_gen(&self) -> (Self::A, Self::Trapdoor)
Samples a parity-check matrix and a trapdoor for that matrix.
Returns the parity-check matrix and the trapdoor.
Sourcefn samp_d(&self) -> Self::Domain
fn samp_d(&self) -> Self::Domain
Samples an element in the domain according to a specified distribution.
Returns the sampled element.
Sourcefn samp_p(
&self,
a: &Self::A,
r: &Self::Trapdoor,
u: &Self::Range,
) -> Self::Domain
fn samp_p( &self, a: &Self::A, r: &Self::Trapdoor, u: &Self::Range, ) -> Self::Domain
Samples an element e in the domain according to a specified distribution
conditioned on f_a(a, e) = u.
Parameters:
a: The parity-check matrixr: The G-Trapdoor forau: The syndrome from the range
Returns a sample e from the domain on the conditioned discrete
Gaussian distribution f_a(a,e) = u.
Sourcefn f_a(&self, a: &Self::A, sigma: &Self::Domain) -> Self::Range
fn f_a(&self, a: &Self::A, sigma: &Self::Domain) -> Self::Range
Implements the efficiently computable function f_a,
which is uniquely classified by a.
Parameters:
a: The parity-check matrix of dimensionsn x msigma: A column vector of lengthm
Returns the result of f_a.
Sourcefn check_domain(&self, sigma: &Self::Domain) -> bool
fn check_domain(&self, sigma: &Self::Domain) -> bool
Checks whether an element is in the correct domain (and not just the correct type).
Returns the result of the check as a boolean.