Small plaintext modulus

Disclaimer: I’m fairly new to FHE and OpenFHE.

I am building an application that works on categorical data with relatively few categories that fit in 8 bits. I want to use Fermat’s little theorem to generate encrypted 1’s for elements that are equal and encrypted 0’s otherwise. To that end, I attempted to change the plaintext modulus to 257, a small prime that fits my data, but I get the error below. I’m not sure what m refers to. I looked in the CCParams but didn’t see anything with the value of 16384.

Please provide a primeModulus(q) and a cyclotomic number(m) satisfying the condition: (q-1)/m is an integer. The values of primeModulus = 257 and m = 16384 do not satisfy this condition

OpenFHE uses CRT packing based on linear terms decomposition. In other words, we use moduli that give the maximum number of slots (= ring dimension). So the minimum plaintext modulus has to be a prime that is congruent to 1 mod m (in other words it is at least m + 1 or larger).

Thanks for the explanation. The plaintext modulus 65537 is working fine for my purposes. If I understand you correctly, decreasing the plaintext modulus requires decreasing the number of slots and ultimately the security level as well.