Generic LWE key generation, sampling, and serialization #
Uniform power-of-two residue sampling, centered-binomial error sampling, LWE public matrix
generation [B * t + e | B], flat uniform random tapes, serialized list/word codecs, exact
distributional bridges to DecisionLWE, and uniform strict polynomial-time certificates.
Main definitions #
Cslib.Crypto.LWE.secretVector: the expanded secret(1, -t).Cslib.Crypto.LWE.publicMatrixInt:[B * t + e | B]with integer errors cast modulo2 ^ w.Cslib.Crypto.LWE.sampleResidue,Cslib.Crypto.LWE.sampleVector,Cslib.Crypto.LWE.sampleMatrix: uniform modular samplers.Cslib.Crypto.LWE.KeyInputs,Cslib.Crypto.LWE.sampleKeyInputs,Cslib.Crypto.LWE.keyGen: typed LWE key generation.Cslib.Crypto.LWE.noiseLaw: scalar centered-binomial modular error distribution.Cslib.Crypto.LWE.SerializedKeyInputs,Cslib.Crypto.LWE.encSerializedKeyInputs,Cslib.Crypto.LWE.sampleKeyInputsSerialized,Cslib.Crypto.LWE.serializeKeyInputs,Cslib.Crypto.LWE.decodeKeyInputs: serialized random key inputs, encoding, and defaulted decoders.Cslib.Crypto.LWE.serializePublicMatrix,Cslib.Crypto.LWE.serializeSecret,Cslib.Crypto.LWE.decodeSecret: bit-word encodings for LWE matrices and secrets.Cslib.Crypto.LWE.secretProductResidue: signed binary row inner product with(1, -secret).Cslib.Crypto.LWE.publicRowHead,Cslib.Crypto.LWE.publicMatrixSerialized,Cslib.Crypto.LWE.secretSerialized,Cslib.Crypto.LWE.keyGenSerialized: executable bit-word key generation.
Main results #
Cslib.Crypto.LWE.publicMatrix_mulVec_secretVector,Cslib.Crypto.LWE.publicMatrixInt_mulVec_secretVector: exact inner-product error identity.Cslib.Crypto.LWE.secretProductResidue_eq,Cslib.Crypto.LWE.secretProductResidue_eq_dotProduct: exactZMod.valcharacterization ofsecretProductResidue.Cslib.Crypto.LWE.mem_support_sampleKeyInputs_iff: exact coordinatewise error bound on supported key inputs.Cslib.Crypto.LWE.exists_uniform_seed_sampleKeyInputs: flat uniform bit-tape realization.Cslib.Crypto.LWE.eval_keyGen_publicMatrix,Cslib.Crypto.LWE.eval_keyGen_publicWord,Cslib.Crypto.LWE.eval_keyGenSerialized_publicWord: exact match withLWE.publicMatrixLawandLWE.realEnsemble.Cslib.Crypto.LWE.isPPTOn_sampleKeyInputsSerialized,Cslib.Crypto.LWE.computableInPolyTime_publicMatrixSerialized,Cslib.Crypto.LWE.computableInPolyTime_secretSerialized,Cslib.Crypto.LWE.computableInPolyTime_secretProductResidue,Cslib.Crypto.LWE.isPPTOn_keyGenSerialized: uniform strict polynomial-time certificates.
References #
- [O. Regev, On lattices, learning with errors, random linear codes, and cryptography] [Reg09]
- C. Gentry, A. Sahai and B. Waters, Homomorphic Encryption from Learning with Errors: Conceptually-Simpler, Asymptotically-Faster, Attribute-Based, Sections 2 and 3.1.
- NIST, Module-Lattice-Based Key-Encapsulation Mechanism Standard, Algorithm 8 for the finite centered-binomial error distribution.
Secret vectors and LWE matrix identities #
Typed LWE key sampling #
A uniform residue sample has the uniform finite-ring law modulo 2 ^ w.
A uniform residue vector sample has the uniform product law modulo 2 ^ w.
A uniform matrix sample has the uniform finite-matrix law modulo 2 ^ w.
The separately sampled secret, public-matrix part, and integer errors.
Uniform secret entries.
Uniform public matrix entries.
Independent bounded integer errors.
Draw the three inputs independently, using the specified finite centered-binomial error law.
The complete joint law retains the independence of the secret, public part, and errors.
Flat uniform tapes for key sampling #
A residue uses a uniform word of exactly its binary width.
Independent residues use disjoint width-sized blocks.
All key-generation inputs are independent functions of disjoint parts of one finite tape.
Serialized random inputs, key serialization, and Decision-LWE bridges #
Secret entries, public-matrix rows, and signed errors, without dependent dimensions.
List of secret vector residue representatives.
List of public-matrix rows (
mrows ofnresidue representatives).List of signed integer errors.
Instances For
Binary residues and signed binary errors, with all list and pair framing.
Independently sample every key-input entry using binary residues and signed errors.
List every residue's canonical representative and every signed error in coordinate order.
Read fixed dimensions from arbitrary lists, padding absent entries with zero and reducing
natural representatives modulo 2 ^ w. Excess entries are ignored.
Canonical lists decode to their original typed key inputs, including empty dimensions.
The efficient key-input sampler has exactly the typed sampler's joint law, including the independence of the secret, public-matrix part, and signed errors.
Decoding the efficient sampled lists recovers the mathematical key-input sampler.
Canonical secret words retain every residue.
Compute the canonical residue modulo 2 ^ w of row row of an (n + 1)-column binary matrix
ciphertextWord multiplied by secretVector (decodeSecret n w secretWord) using signed binary
subtraction.
At width zero, secretProductResidue reduces modulo 1 and returns 0.
Signed word arithmetic computes the canonical residue of row row paired with
(1, -secret).
For row : Fin r, secretProductResidue computes the canonical residue of row row of
Matrix.ofBinary r (n + 1) w ciphertextWord dotted with
secretVector (decodeSecret n w secretWord).
A serialized secret vector has exact bit length n * w.
Compute the public word from arbitrary serialized sampled inputs.
The binary signed-remainder computation returns the canonical leading public residue.
The total public-key computation is exactly the typed public matrix of the decoded inputs.
The total secret computation agrees with the same padded and modularly normalized inputs.
Canonical sampled inputs produce exactly the original typed public key.
Canonical sampled inputs produce exactly the original typed secret key.
Every arbitrary input produces the complete declared public word.
Secret normalization retains exactly the declared number of residue bits.
The efficient key sampler retains the typed construction's complete public/secret joint law.
Decision-LWE error law and public-word ensembles #
Reducing independent integer errors preserves the complete independent modular error law.
The generated public matrix is an exact decision-LWE sample.
Encoding the actual public marginal gives the encoded real matrix realEnsemble of
DecisionLWE (decisionLWE_iff_encoded).
The actual serialized key generator has precisely the public marginal realEnsemble of
DecisionLWE.
Uniform polynomial-time certificates for LWE key generation #
Uniform strict PPT generation of every serialized key input.
Compute a public row's leading residue from arbitrary binary inputs and signed errors.
Construct the entire public word, charging the runtime number and width of every entry.
Normalize and write the declared number of binary secret coordinates.
Compute the modular row inner product secretProductResidue in polynomial time.
The complete key generator is strict PPT for arbitrary efficient runtime dimensions.