# If I package three vectors into one ciphertext, how can the server split them into three ciphertexts after receiving the ciphertext

**URL:** <https://openfhe.discourse.group/t/if-i-package-three-vectors-into-one-ciphertext-how-can-the-server-split-them-into-three-ciphertexts-after-receiving-the-ciphertext/710>\
**Category:** FHE Questions\
**Created:** [July 20, 2023, 8:29am UTC](https://openfhe.discourse.group/t/if-i-package-three-vectors-into-one-ciphertext-how-can-the-server-split-them-into-three-ciphertexts-after-receiving-the-ciphertext/710 "2023-07-20T08:29:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kenan](https://avatars.discourse-cdn.com/v4/letter/k/e495f1/32.png) [@kenan](https://openfhe.discourse.group/u/kenan)\
**Post date:** [July 20, 2023, 8:29am UTC](https://openfhe.discourse.group/t/if-i-package-three-vectors-into-one-ciphertext-how-can-the-server-split-them-into-three-ciphertexts-after-receiving-the-ciphertext/710/1 "2023-07-20T08:29:06Z")

</div>

If I package three vectors into one ciphertext, how can the server split them into three ciphertexts after receiving the ciphertext

---

<div class="post-metadata">

**Author:** ![iquah](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/iquah/32/8_2.png) [@iquah](https://openfhe.discourse.group/u/iquah)\
**Post date:** [July 20, 2023, 1:00pm UTC](https://openfhe.discourse.group/t/if-i-package-three-vectors-into-one-ciphertext-how-can-the-server-split-them-into-three-ciphertexts-after-receiving-the-ciphertext/710/2 "2023-07-20T13:00:53Z")

</div>

You’ll have to mask them out by multiplying with a vector of 0’s and 1’s

---

<div class="post-metadata">

**Author:** ![kenan](https://avatars.discourse-cdn.com/v4/letter/k/e495f1/32.png) [@kenan](https://openfhe.discourse.group/u/kenan)\
**Post date:** [July 20, 2023, 1:58pm UTC](https://openfhe.discourse.group/t/if-i-package-three-vectors-into-one-ciphertext-how-can-the-server-split-them-into-three-ciphertexts-after-receiving-the-ciphertext/710/3 "2023-07-20T13:58:39Z")

</div>

Can you give an example?such as  
vector a1={1,2,3,4,5};  
vector a2={1,2,3,4,5};  
vector a3={1,2,3,4,5};  
vector\<vector \> a4;  
a4.push\_back(a1);  
a4.push\_back(a2);  
a4.push\_back(a3);  
ciphertext c=encrypt(a4);  
server split ciphertext into three ciphertext as c1,c2,c3

---

<div class="post-metadata">

**Author:** ![narger](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/narger/32/420_2.png) [@narger](https://openfhe.discourse.group/u/narger)\
**Post date:** [July 20, 2023, 2:16pm UTC](https://openfhe.discourse.group/t/if-i-package-three-vectors-into-one-ciphertext-how-can-the-server-split-them-into-three-ciphertexts-after-receiving-the-ciphertext/710/4 "2023-07-20T14:16:41Z")

</div>

I suggest you to take advantage of batching and to use them in a single ciphertext.

Anyway, you could do something like this:

vector mask1 = {1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ,0};  
vector mask2 = {0, 0, 0 ,0 ,0 1, 1, 1, 1, 1, 0, 0, 0, 0, 0};  
vector mask3 = {0, 0, 0, 0, 0, 0, 0, 0, 0 ,0, 1, 1, 1, 1, 1};

c1 = c \times mask1  
c2 = c \times mask2  
c3 = c \times mask3

---

<div class="post-metadata">

**Author:** ![kenan](https://avatars.discourse-cdn.com/v4/letter/k/e495f1/32.png) [@kenan](https://openfhe.discourse.group/u/kenan)\
**Post date:** [July 20, 2023, 3:55pm UTC](https://openfhe.discourse.group/t/if-i-package-three-vectors-into-one-ciphertext-how-can-the-server-split-them-into-three-ciphertexts-after-receiving-the-ciphertext/710/5 "2023-07-20T15:55:31Z")

</div>

thank you! I will try

---

<div class="post-metadata">

**Author:** ![dcousins](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/dcousins/32/71_2.png) [@dcousins](https://openfhe.discourse.group/u/dcousins)\
**Post date:** [July 24, 2023, 3:27pm UTC](https://openfhe.discourse.group/t/if-i-package-three-vectors-into-one-ciphertext-how-can-the-server-split-them-into-three-ciphertexts-after-receiving-the-ciphertext/710/6 "2023-07-24T15:27:39Z")

</div>

Additionally if you need them as separate vector CT, and want them to be indexed the same you could rotate c2 left by the vector length, and c3 left by 2xvector length, Remembering that the rotation happens over the entire ciphertext vector.
