# Bootstrap only to a part of cyphertext?

**URL:** <https://openfhe.discourse.group/t/bootstrap-only-to-a-part-of-cyphertext/2242>\
**Category:** Library Questions\
**Created:** [December 18, 2025, 6:57pm UTC](https://openfhe.discourse.group/t/bootstrap-only-to-a-part-of-cyphertext/2242 "2025-12-18T18:57:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kratess](https://avatars.discourse-cdn.com/v4/letter/k/3ab097/32.png) [@kratess](https://openfhe.discourse.group/u/kratess)\
**Post date:** [December 18, 2025, 6:57pm UTC](https://openfhe.discourse.group/t/bootstrap-only-to-a-part-of-cyphertext/2242/1 "2025-12-18T18:57:15Z")

</div>

I saw `cryptoContext->EvalBootstrapKeyGen(keyPair.secretKey, numSlots);` Why do we have to spacify the numSlots. Can’t the cryptocontext get it automatically? Can we do bootstrap only to a segment of the ct?

---

<div class="post-metadata">

**Author:** ![andreea.alexandru](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/andreea.alexandru/32/378_2.png) [@andreea.alexandru](https://openfhe.discourse.group/u/andreea.alexandru)\
**Post date:** [December 22, 2025, 2:25pm UTC](https://openfhe.discourse.group/t/bootstrap-only-to-a-part-of-cyphertext/2242/2 "2025-12-22T14:25:09Z")

</div>

This is about sparse packing, where when you know that you need to work with fewer than ringDim/2 values, you can specify a number of slots (a power of 2 less than ringDim/2) and work with the corresponding subring. Bootstrapping can benefit from using a smaller number of slots (it becomes more efficient), but this doesn’t mean you only bootstrap some slots and not others–all slots are bootstrapped.

By default, `numSlots` is the value specified as `batchSize` when creating the cryptocontext. However, OpenFHE supports doing bootstrapping for different values of slots, as there are applications where this is a useful feature. In that case, you can do the necessary key generation and precomputations for various values of slots. You can check the example [here](https://github.com/openfheorg/openfhe-development/blob/main/src/pke/extras/ckks-bootstrap.cpp).
