Botan 3.6.1
Crypto and TLS for C&
Botan::Kyber_Algos::PolynomialSampler< SeedT > Class Template Reference

#include <kyber_algos.h>

Public Member Functions

 PolynomialSampler (StrongSpan< const SeedT > seed, const KyberConstants &mode)
 
KyberPoly sample_polynomial_cbd_eta2 ()
 
KyberPolyVec sample_polynomial_vector_cbd_eta1 ()
 
KyberPolyVec sample_polynomial_vector_cbd_eta2 ()
 

Detailed Description

template<typename SeedT>
requires std::same_as<KyberSeedSigma, SeedT> || std::same_as<KyberEncryptionRandomness, SeedT>
class Botan::Kyber_Algos::PolynomialSampler< SeedT >

Allows sampling multiple polynomials from a single seed via a XOF.

Used in Algorithms 13 (K-PKE.KeyGen) and 14 (K-PKE.Encrypt), and takes care of the continuous nonce value internally.

Definition at line 65 of file kyber_algos.h.

Constructor & Destructor Documentation

◆ PolynomialSampler()

template<typename SeedT >
Botan::Kyber_Algos::PolynomialSampler< SeedT >::PolynomialSampler ( StrongSpan< const SeedT > seed,
const KyberConstants & mode )
inline

Definition at line 67 of file kyber_algos.h.

67 :
68 m_seed(seed), m_mode(mode), m_nonce(0) {}

Member Function Documentation

◆ sample_polynomial_cbd_eta2()

template<typename SeedT >
KyberPoly Botan::Kyber_Algos::PolynomialSampler< SeedT >::sample_polynomial_cbd_eta2 ( )
inline

Definition at line 78 of file kyber_algos.h.

80 {
81 KyberPoly poly;
82 sample_poly_cbd(poly, m_mode.eta2());
83 return poly;
84 }
constexpr KyberEta eta2() const
Botan::CRYSTALS::Polynomial< KyberPolyTraits, Botan::CRYSTALS::Domain::Normal > KyberPoly
Definition kyber_types.h:29

References Botan::KyberConstants::eta2().

Referenced by Botan::Kyber_PublicKeyInternal::indcpa_encrypt().

◆ sample_polynomial_vector_cbd_eta1()

template<typename SeedT >
KyberPolyVec Botan::Kyber_Algos::PolynomialSampler< SeedT >::sample_polynomial_vector_cbd_eta1 ( )
inline

Definition at line 70 of file kyber_algos.h.

70 {
71 KyberPolyVec vec(m_mode.k());
72 for(auto& poly : vec) {
73 sample_poly_cbd(poly, m_mode.eta1());
74 }
75 return vec;
76 }
KyberEta eta1() const
Botan::CRYSTALS::PolynomialVector< KyberPolyTraits, Botan::CRYSTALS::Domain::Normal > KyberPolyVec
Definition kyber_types.h:30

References Botan::KyberConstants::eta1(), and Botan::KyberConstants::k().

Referenced by Botan::Kyber_Algos::expand_keypair(), and Botan::Kyber_PublicKeyInternal::indcpa_encrypt().

◆ sample_polynomial_vector_cbd_eta2()

template<typename SeedT >
KyberPolyVec Botan::Kyber_Algos::PolynomialSampler< SeedT >::sample_polynomial_vector_cbd_eta2 ( )
inline

Definition at line 86 of file kyber_algos.h.

88 {
89 KyberPolyVec vec(m_mode.k());
90 for(auto& poly : vec) {
91 sample_poly_cbd(poly, m_mode.eta2());
92 }
93 return vec;
94 }

References Botan::KyberConstants::eta2(), and Botan::KyberConstants::k().

Referenced by Botan::Kyber_PublicKeyInternal::indcpa_encrypt().


The documentation for this class was generated from the following file: