Encryption
August 25, 20264 min readbeginner
Alice holds pk = (, t) and wants to encrypt a 256-bit message m using fresh randomness r.
Alice holds and wants to encrypt a 256-bit message using fresh randomness .
01.The steps
E1. Rebuild . Alice runs the same rejection sampling on that key generation ran, reconstructing , and takes its transpose.
The transpose is not cosmetic. Key generation multiplied by , encryption multiplies by , and the cancellation in Why Decryption Works happens only because of that pairing. Getting it backwards produces a scheme that encrypts fine and never decrypts, which is a memorable way to lose an afternoon.
E2. Sample three small things. Using as a seed:
Here is Alice's own ephemeral secret, discarded after this one encryption. The other two are fresh errors whose job is to keep the outputs looking random.
E3. Compute .
Look at the shape of that. It is a Module-LWE sample, with in the secret position. So to an attacker is polynomials indistinguishable from uniform.
E4. Encode the message. Each of the 256 message bits becomes one coefficient:
The two anchors are as far apart as allows. Decryption will recover each bit by asking which anchor the coefficient is nearer to, so maximising the separation maximises the noise that can be tolerated. Why Decryption Works turns that into an exact bound.
E5. Compute .
A single polynomial holding the encoded message underneath a mask , which again has the shape of a Module-LWE sample. Separating the message from the mask without is the hard problem.
E6. Compress. Discard low-order bits of both parts before transmission, using bits per coefficient of and bits per coefficient of . Compression and Ciphertext Size covers the mechanics and why the two numbers differ.
E7. Emit.
For , , , :
02.Why there are two ciphertext components
A reasonable question at this point is why the ciphertext has two parts with different shapes.
They do different jobs. The vector carries Alice's ephemeral secret in masked form, which is what lets Bob reconstruct the same mask she used. The single polynomial carries the message under that mask.
Bob's decryption is going to compute . For that to strip the mask, must contain multiplied by something Bob's secret can undo, which is what provides. Neither component alone reveals anything, and together they reveal the message only to whoever holds .
This is the same structural idea as Diffie-Hellman in Chapter 2, where each party sent a masked version of its own secret and the shared value emerged from combining them. Here the combination is lattice arithmetic and one side's contribution is baked into a published key rather than sent live.
03.What an attacker sees
The full ciphertext is polynomials, all of which look uniform. There are two separate Module-LWE instances in play: one from key generation with secret , one from this encryption with secret .
Recovering the message needs one of them broken. The message itself sits in under a mask that is exactly as hard to remove as Module-LWE is to solve.
One consequence is worth flagging for the next chapter. The randomness in step E2 must be fresh for every encryption. Reusing it against the same public key produces two ciphertexts with the same , and their difference is the difference of the two encoded messages with all the masking cancelled. That is a total break, and it is why the wrapper in The Fujisaki-Okamoto Wrapper is careful about where randomness comes from.