diff options
author | Arun Isaac | 2025-07-25 12:59:48 +0100 |
---|---|---|
committer | Arun Isaac | 2025-08-01 00:33:32 +0100 |
commit | c14ba72e44d996952e55cadfc43f4c62b009d870 (patch) | |
tree | 1ee423cf3f69790e41c0ab15dcb0512cacad2038 /tests/test_pyhegp.py | |
parent | 40bef67c4dffce756f6cb41a65e87867295146a7 (diff) | |
download | pyhegp-c14ba72e44d996952e55cadfc43f4c62b009d870.tar.gz pyhegp-c14ba72e44d996952e55cadfc43f4c62b009d870.tar.lz pyhegp-c14ba72e44d996952e55cadfc43f4c62b009d870.zip |
Separate standardization from encryption.
* pyhegp/pyhegp.py (hegp_encrypt, hegp_decrypt): Do not standardize or unstandardize. (encrypt): Standardize before calling hegp_encrypt. * tests/test_pyhegp.py (test_hegp_encryption_decryption_are_inverses): Do not pass mean and standard deviation for standardization and unstandardization.
Diffstat (limited to 'tests/test_pyhegp.py')
-rw-r--r-- | tests/test_pyhegp.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/tests/test_pyhegp.py b/tests/test_pyhegp.py index 2d2a258..c494d30 100644 --- a/tests/test_pyhegp.py +++ b/tests/test_pyhegp.py @@ -53,17 +53,11 @@ def no_column_zero_standard_deviation(matrix): elements=st.integers(min_value=0, max_value=100)), arrays("float64", array_shapes(min_dims=2, max_dims=2, min_side=2), - elements=st.floats(min_value=0, max_value=100))) - # Reject matrices with zero standard deviation columns since - # they trigger a division by zero. - .filter(no_column_zero_standard_deviation)) + elements=st.floats(min_value=0, max_value=100)))) def test_hegp_encryption_decryption_are_inverses(plaintext): - mean = np.mean(plaintext, axis=0) - standard_deviation = np.std(plaintext, axis=0) rng = np.random.default_rng() key = random_key(rng, len(plaintext)) - assert hegp_decrypt(hegp_encrypt(plaintext, mean, standard_deviation, key), - mean, standard_deviation, key) == approx(plaintext) + assert hegp_decrypt(hegp_encrypt(plaintext, key), key) == approx(plaintext) @given(arrays("float64", array_shapes(min_dims=2, max_dims=2), |