# Implementation of Encryption Using the Finite Field Z2

**URL:** <https://openfhe.discourse.group/t/implementation-of-encryption-using-the-finite-field-z2/1366>\
**Category:** FHE Use Cases\
**Tags:** openfhe-help\
**Created:** [June 20, 2024, 3:12am UTC](https://openfhe.discourse.group/t/implementation-of-encryption-using-the-finite-field-z2/1366 "2024-06-20T03:12:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zgl404](https://avatars.discourse-cdn.com/v4/letter/z/ce73a5/32.png) [@zgl404](https://openfhe.discourse.group/u/zgl404)\
**Post date:** [June 20, 2024, 3:12am UTC](https://openfhe.discourse.group/t/implementation-of-encryption-using-the-finite-field-z2/1366/1 "2024-06-20T03:12:59Z")

</div>

I am currently exploring the concept of multimedia encryption and have come across the use of the finite field 𝑍2 for cryptographic purposes, particularly in the context of homomorphic encryption. I am interested in understanding how to practically implement encryption using this field. this is the paper

> subframes in a frame are encrypted with plaintexts ∈ Z2, wherein addition and multiplication are equivalent to binary XOR and AND operations, respectively. For b ∈ Z2, its ciphertext is denoted as [b]. For an integer n, [n] denotes its binary encryption, i.e., encryption of each bit in its binary representation. In our work, BGV is used as the homomorphic encryption.

how can I use Openfhe to implement it?

---

<div class="post-metadata">

**Author:** ![Caesar](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/caesar/32/63_2.png) [@Caesar](https://openfhe.discourse.group/u/Caesar)\
**Post date:** [June 21, 2024, 2:20pm UTC](https://openfhe.discourse.group/t/implementation-of-encryption-using-the-finite-field-z2/1366/2 "2024-06-21T14:20:56Z")

</div>

The question is not very clear to me.

Note you can use binFHE schemes in OpenFHE to do arithmetic in \mathbb{Z}\_2 efficiently. Check the examples [here](https://github.com/openfheorg/openfhe-development/tree/main/src/binfhe/examples).

Also, can you provide a link to the referenced paper?

---

<div class="post-metadata">

**Author:** ![zgl404](https://avatars.discourse-cdn.com/v4/letter/z/ce73a5/32.png) [@zgl404](https://openfhe.discourse.group/u/zgl404)\
**Post date:** [June 22, 2024, 2:49am UTC](https://openfhe.discourse.group/t/implementation-of-encryption-using-the-finite-field-z2/1366/3 "2024-06-22T02:49:12Z")

</div>

“Yes, I can utilize binary Fully Homomorphic Encryption (binFHE). However, I am concerned that binFHE might not support SIMD operations, which allow for the packing of multiple plaintexts into a single ciphertext. Therefore, I am seeking alternative methods to achieve the desired functionality in Z2.”  
the paper DOI：([Decoding Homomorphically Encrypted Flac Audio without Decryption | IEEE Conference Publication | IEEE Xplore](https://doi.org/10.1109/ICASSP.2019.8682780))。this paper use HElib to implement something.

---

<div class="post-metadata">

**Author:** ![ypolyakov](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/ypolyakov/32/47_2.png) [@ypolyakov](https://openfhe.discourse.group/u/ypolyakov)\
**Post date:** [June 24, 2024, 12:40pm UTC](https://openfhe.discourse.group/t/implementation-of-encryption-using-the-finite-field-z2/1366/4 "2024-06-24T12:40:43Z")

</div>

Hi @zgl404,

The Z2 arithmetic can also be supported in BGV and BFV, but this requires the use of non-power-of-two cyclotomics (to support CRT batching). Helib supports this plaintext algebra. OpenFHE currently does not support non-power-of-two cyclotomics at the level of crypto schemes (it only supports it at a lower lattice layer).

There is a also a very recent work that implements Z2 arithmetic in CKKS: [Bootstrapping Bits with CKKS](https://eprint.iacr.org/2024/767)

---

<div class="post-metadata">

**Author:** ![zgl404](https://avatars.discourse-cdn.com/v4/letter/z/ce73a5/32.png) [@zgl404](https://openfhe.discourse.group/u/zgl404)\
**Post date:** [June 24, 2024, 1:50pm UTC](https://openfhe.discourse.group/t/implementation-of-encryption-using-the-finite-field-z2/1366/5 "2024-06-24T13:50:04Z")

</div>

WoW! that’s so cool! how can i use the new feature in this paper—— [Bootstrapping Bits with CKKS (iacr.org)](https://eprint.iacr.org/2024/767)

---

<div class="post-metadata">

**Author:** ![ypolyakov](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/ypolyakov/32/47_2.png) [@ypolyakov](https://openfhe.discourse.group/u/ypolyakov)\
**Post date:** [June 25, 2024, 9:13pm UTC](https://openfhe.discourse.group/t/implementation-of-encryption-using-the-finite-field-z2/1366/6 "2024-06-25T21:13:44Z")

</div>

I have not had a chance to look at this work in more detail yet. I am also not aware of an OpenFHE implementation of it at the moment. We will look into this work a little bit later. If someone has already implemented it in OpenFHE, please chime in 🙂
