-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathtest_cryptocontext.py
More file actions
28 lines (25 loc) · 1 KB
/
test_cryptocontext.py
File metadata and controls
28 lines (25 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import pytest
import openfhe as fhe
@pytest.mark.skipif(fhe.get_native_int() != 128, reason="Only for NATIVE_INT=128")
@pytest.mark.parametrize("scaling", [fhe.FIXEDAUTO, fhe.FIXEDMANUAL])
def test_ckks_context_nativeint128(scaling):
batch_size = 8
parameters = fhe.CCParamsCKKSRNS()
parameters.SetMultiplicativeDepth(5)
parameters.SetScalingModSize(78)
parameters.SetBatchSize(batch_size)
parameters.SetScalingTechnique(scaling)
parameters.SetNumLargeDigits(2)
cc = fhe.GenCryptoContext(parameters)
assert isinstance(cc, fhe.CryptoContext)
@pytest.mark.parametrize("scaling", [fhe.FIXEDAUTO, fhe.FIXEDMANUAL])
def test_ckks_context(scaling):
batch_size = 8
parameters = fhe.CCParamsCKKSRNS()
parameters.SetMultiplicativeDepth(5)
parameters.SetScalingModSize(60-1)
parameters.SetBatchSize(batch_size)
parameters.SetScalingTechnique(scaling)
parameters.SetNumLargeDigits(2)
cc = fhe.GenCryptoContext(parameters)
assert isinstance(cc, fhe.CryptoContext)