From 37f0567bb610b430152d42b71dee2d3316d88ec5 Mon Sep 17 00:00:00 2001 From: Arthur Meyre Date: Wed, 16 Oct 2024 17:48:43 +0200 Subject: [PATCH] chore: update data for the 0.9 breaking change --- .github/workflows/cargo_build.yml | 2 +- Cargo.lock | 164 ++--- Cargo.toml | 27 +- data/0_6/high_level_api/bool1.bcode | 3 - data/0_6/high_level_api/bool1.cbor | 3 - data/0_6/high_level_api/bool2.bcode | 3 - data/0_6/high_level_api/bool2.cbor | 3 - data/0_6/high_level_api/bool_list.bcode | 3 - data/0_6/high_level_api/bool_list.cbor | 3 - data/0_6/high_level_api/client_key.bcode | 3 - data/0_6/high_level_api/client_key.cbor | 3 - .../client_key_for_pubkey.bcode | 3 - .../high_level_api/client_key_for_pubkey.cbor | 3 - data/0_6/high_level_api/compact_bool.bcode | 3 - data/0_6/high_level_api/compact_bool.cbor | 3 - .../high_level_api/compact_public_key.bcode | 3 - .../high_level_api/compact_public_key.cbor | 3 - .../compressed_compact_public_key.bcode | 3 - .../compressed_compact_public_key.cbor | 3 - .../compressed_modswitched_bool.bcode | 3 - .../compressed_modswitched_bool.cbor | 3 - .../compressed_public_key.bcode | 3 - .../high_level_api/compressed_public_key.cbor | 3 - .../compressed_seeded_bool.bcode | 3 - .../compressed_seeded_bool.cbor | 3 - .../compressed_server_key.bcode | 3 - .../high_level_api/compressed_server_key.cbor | 3 - data/0_6/high_level_api/ct1.bcode | 3 - data/0_6/high_level_api/ct1.cbor | 3 - data/0_6/high_level_api/ct1_signed.bcode | 3 - data/0_6/high_level_api/ct1_signed.cbor | 3 - data/0_6/high_level_api/ct2.bcode | 3 - data/0_6/high_level_api/ct2.cbor | 3 - data/0_6/high_level_api/ct2_signed.bcode | 3 - data/0_6/high_level_api/ct2_signed.cbor | 3 - data/0_6/high_level_api/ct_compact.bcode | 3 - data/0_6/high_level_api/ct_compact.cbor | 3 - .../high_level_api/ct_compact_signed.bcode | 3 - .../0_6/high_level_api/ct_compact_signed.cbor | 3 - .../ct_compressed_modswitched.bcode | 3 - .../ct_compressed_modswitched.cbor | 3 - .../ct_compressed_modswitched_signed.bcode | 3 - .../ct_compressed_modswitched_signed.cbor | 3 - .../high_level_api/ct_compressed_seeded.bcode | 3 - .../high_level_api/ct_compressed_seeded.cbor | 3 - .../ct_compressed_seeded_signed.bcode | 3 - .../ct_compressed_seeded_signed.cbor | 3 - data/0_6/high_level_api/ct_list.bcode | 3 - data/0_6/high_level_api/ct_list.cbor | 3 - data/0_6/high_level_api/ct_list_signed.bcode | 3 - data/0_6/high_level_api/ct_list_signed.cbor | 3 - data/0_6/high_level_api/public_key.bcode | 3 - data/0_6/high_level_api/public_key.cbor | 3 - data/0_6/high_level_api/server_key.bcode | 3 - data/0_6/high_level_api/server_key.cbor | 3 - data/0_7/high_level_api/client_key.cbor | 3 - .../client_key_with_compression.bcode | 3 - .../client_key_with_compression.cbor | 3 - .../hl_compressed_heterogeneous_list.bcode | 3 - .../hl_compressed_heterogeneous_list.cbor | 3 - .../hl_heterogeneous_list.bcode | 3 - .../high_level_api/hl_heterogeneous_list.cbor | 3 - .../hl_packed_heterogeneous_list.bcode | 3 - .../hl_packed_heterogeneous_list.cbor | 3 - .../server_key_with_compression.bcode | 3 - .../server_key_with_compression.cbor | 3 - .../high_level_api/batch_1_client_key.bcode | 3 + .../high_level_api/batch_1_client_key.cbor | 3 + .../high_level_api/batch_2_client_key.cbor | 3 + data/0_8/high_level_api/bool1.bcode | 3 + data/0_8/high_level_api/bool1.cbor | 3 + data/0_8/high_level_api/bool2.bcode | 3 + data/0_8/high_level_api/bool2.cbor | 3 + data/0_8/high_level_api/client_key.cbor | 3 - .../high_level_api/client_key_for_pubkey.cbor | 3 + .../client_key_with_compression.bcode | 3 + .../client_key_with_compression.cbor | 3 + .../high_level_api/compact_public_key.bcode | 3 + .../high_level_api/compact_public_key.cbor | 3 + .../compressed_compact_public_key.bcode | 3 + .../compressed_compact_public_key.cbor | 3 + .../compressed_legacy_public_key.bcode | 3 + .../compressed_legacy_public_key.cbor | 3 + .../compressed_modswitched_bool.bcode | 3 + .../compressed_modswitched_bool.cbor | 3 + .../compressed_seeded_bool.bcode | 3 + .../compressed_seeded_bool.cbor | 3 + data/0_8/high_level_api/ct1.bcode | 3 + data/0_8/high_level_api/ct1.cbor | 3 + data/0_8/high_level_api/ct1_signed.bcode | 3 + data/0_8/high_level_api/ct1_signed.cbor | 3 + data/0_8/high_level_api/ct2.bcode | 3 + data/0_8/high_level_api/ct2.cbor | 3 + data/0_8/high_level_api/ct2_signed.bcode | 3 + data/0_8/high_level_api/ct2_signed.cbor | 3 + .../ct_compressed_modswitched.bcode | 3 + .../ct_compressed_modswitched.cbor | 3 + .../ct_compressed_modswitched_signed.bcode | 3 + .../ct_compressed_modswitched_signed.cbor | 3 + .../high_level_api/ct_compressed_seeded.bcode | 3 + .../high_level_api/ct_compressed_seeded.cbor | 3 + .../ct_compressed_seeded_signed.bcode | 3 + .../ct_compressed_seeded_signed.cbor | 3 + .../hl_compressed_heterogeneous_list.bcode | 3 + .../hl_compressed_heterogeneous_list.cbor | 3 + .../hl_heterogeneous_list.bcode | 3 + .../high_level_api/hl_heterogeneous_list.cbor | 3 + .../hl_packed_heterogeneous_list.bcode | 3 + .../hl_packed_heterogeneous_list.cbor | 3 + .../hl_proven_heterogeneous_list.bcode | 2 +- .../hl_proven_heterogeneous_list.cbor | 2 +- .../hl_proven_packed_heterogeneous_list.bcode | 3 - .../hl_proven_packed_heterogeneous_list.cbor | 3 - .../high_level_api/legacy_public_key.bcode | 3 + .../0_8/high_level_api/legacy_public_key.cbor | 3 + data/0_8/high_level_api/public_key.cbor | 2 +- data/0_8/high_level_api/server_key.bcode | 3 + data/0_8/high_level_api/server_key.cbor | 3 + .../server_key_with_compression.bcode | 3 + .../server_key_with_compression.cbor | 3 + data/{0_6 => 0_8}/shortint/client_key.bcode | 0 data/{0_6 => 0_8}/shortint/client_key.cbor | 0 data/{0_6 => 0_8}/shortint/ct1.bcode | 0 data/{0_6 => 0_8}/shortint/ct1.cbor | 0 data/{0_6 => 0_8}/shortint/ct2.bcode | 0 data/{0_6 => 0_8}/shortint/ct2.cbor | 0 data/0_9/high_level_api/client_key.bcode | 3 + data/0_9/high_level_api/client_key.cbor | 3 + .../compressed_server_key.bcode | 3 + .../high_level_api/compressed_server_key.cbor | 3 + data/high_level_api.ron | 292 ++++---- data/shortint.ron | 10 +- src/data_0_6.rs | 512 ------------- src/data_0_7.rs | 239 ------ src/data_0_8.rs | 686 +++++++++++++++--- src/data_0_9.rs | 159 ++++ src/generate.rs | 78 +- src/lib.rs | 23 +- src/main.rs | 16 +- 139 files changed, 1208 insertions(+), 1360 deletions(-) delete mode 100644 data/0_6/high_level_api/bool1.bcode delete mode 100644 data/0_6/high_level_api/bool1.cbor delete mode 100644 data/0_6/high_level_api/bool2.bcode delete mode 100644 data/0_6/high_level_api/bool2.cbor delete mode 100644 data/0_6/high_level_api/bool_list.bcode delete mode 100644 data/0_6/high_level_api/bool_list.cbor delete mode 100644 data/0_6/high_level_api/client_key.bcode delete mode 100644 data/0_6/high_level_api/client_key.cbor delete mode 100644 data/0_6/high_level_api/client_key_for_pubkey.bcode delete mode 100644 data/0_6/high_level_api/client_key_for_pubkey.cbor delete mode 100644 data/0_6/high_level_api/compact_bool.bcode delete mode 100644 data/0_6/high_level_api/compact_bool.cbor delete mode 100644 data/0_6/high_level_api/compact_public_key.bcode delete mode 100644 data/0_6/high_level_api/compact_public_key.cbor delete mode 100644 data/0_6/high_level_api/compressed_compact_public_key.bcode delete mode 100644 data/0_6/high_level_api/compressed_compact_public_key.cbor delete mode 100644 data/0_6/high_level_api/compressed_modswitched_bool.bcode delete mode 100644 data/0_6/high_level_api/compressed_modswitched_bool.cbor delete mode 100644 data/0_6/high_level_api/compressed_public_key.bcode delete mode 100644 data/0_6/high_level_api/compressed_public_key.cbor delete mode 100644 data/0_6/high_level_api/compressed_seeded_bool.bcode delete mode 100644 data/0_6/high_level_api/compressed_seeded_bool.cbor delete mode 100644 data/0_6/high_level_api/compressed_server_key.bcode delete mode 100644 data/0_6/high_level_api/compressed_server_key.cbor delete mode 100644 data/0_6/high_level_api/ct1.bcode delete mode 100644 data/0_6/high_level_api/ct1.cbor delete mode 100644 data/0_6/high_level_api/ct1_signed.bcode delete mode 100644 data/0_6/high_level_api/ct1_signed.cbor delete mode 100644 data/0_6/high_level_api/ct2.bcode delete mode 100644 data/0_6/high_level_api/ct2.cbor delete mode 100644 data/0_6/high_level_api/ct2_signed.bcode delete mode 100644 data/0_6/high_level_api/ct2_signed.cbor delete mode 100644 data/0_6/high_level_api/ct_compact.bcode delete mode 100644 data/0_6/high_level_api/ct_compact.cbor delete mode 100644 data/0_6/high_level_api/ct_compact_signed.bcode delete mode 100644 data/0_6/high_level_api/ct_compact_signed.cbor delete mode 100644 data/0_6/high_level_api/ct_compressed_modswitched.bcode delete mode 100644 data/0_6/high_level_api/ct_compressed_modswitched.cbor delete mode 100644 data/0_6/high_level_api/ct_compressed_modswitched_signed.bcode delete mode 100644 data/0_6/high_level_api/ct_compressed_modswitched_signed.cbor delete mode 100644 data/0_6/high_level_api/ct_compressed_seeded.bcode delete mode 100644 data/0_6/high_level_api/ct_compressed_seeded.cbor delete mode 100644 data/0_6/high_level_api/ct_compressed_seeded_signed.bcode delete mode 100644 data/0_6/high_level_api/ct_compressed_seeded_signed.cbor delete mode 100644 data/0_6/high_level_api/ct_list.bcode delete mode 100644 data/0_6/high_level_api/ct_list.cbor delete mode 100644 data/0_6/high_level_api/ct_list_signed.bcode delete mode 100644 data/0_6/high_level_api/ct_list_signed.cbor delete mode 100644 data/0_6/high_level_api/public_key.bcode delete mode 100644 data/0_6/high_level_api/public_key.cbor delete mode 100644 data/0_6/high_level_api/server_key.bcode delete mode 100644 data/0_6/high_level_api/server_key.cbor delete mode 100644 data/0_7/high_level_api/client_key.cbor delete mode 100644 data/0_7/high_level_api/client_key_with_compression.bcode delete mode 100644 data/0_7/high_level_api/client_key_with_compression.cbor delete mode 100644 data/0_7/high_level_api/hl_compressed_heterogeneous_list.bcode delete mode 100644 data/0_7/high_level_api/hl_compressed_heterogeneous_list.cbor delete mode 100644 data/0_7/high_level_api/hl_heterogeneous_list.bcode delete mode 100644 data/0_7/high_level_api/hl_heterogeneous_list.cbor delete mode 100644 data/0_7/high_level_api/hl_packed_heterogeneous_list.bcode delete mode 100644 data/0_7/high_level_api/hl_packed_heterogeneous_list.cbor delete mode 100644 data/0_7/high_level_api/server_key_with_compression.bcode delete mode 100644 data/0_7/high_level_api/server_key_with_compression.cbor create mode 100644 data/0_8/high_level_api/batch_1_client_key.bcode create mode 100644 data/0_8/high_level_api/batch_1_client_key.cbor create mode 100644 data/0_8/high_level_api/batch_2_client_key.cbor create mode 100644 data/0_8/high_level_api/bool1.bcode create mode 100644 data/0_8/high_level_api/bool1.cbor create mode 100644 data/0_8/high_level_api/bool2.bcode create mode 100644 data/0_8/high_level_api/bool2.cbor delete mode 100644 data/0_8/high_level_api/client_key.cbor create mode 100644 data/0_8/high_level_api/client_key_for_pubkey.cbor create mode 100644 data/0_8/high_level_api/client_key_with_compression.bcode create mode 100644 data/0_8/high_level_api/client_key_with_compression.cbor create mode 100644 data/0_8/high_level_api/compact_public_key.bcode create mode 100644 data/0_8/high_level_api/compact_public_key.cbor create mode 100644 data/0_8/high_level_api/compressed_compact_public_key.bcode create mode 100644 data/0_8/high_level_api/compressed_compact_public_key.cbor create mode 100644 data/0_8/high_level_api/compressed_legacy_public_key.bcode create mode 100644 data/0_8/high_level_api/compressed_legacy_public_key.cbor create mode 100644 data/0_8/high_level_api/compressed_modswitched_bool.bcode create mode 100644 data/0_8/high_level_api/compressed_modswitched_bool.cbor create mode 100644 data/0_8/high_level_api/compressed_seeded_bool.bcode create mode 100644 data/0_8/high_level_api/compressed_seeded_bool.cbor create mode 100644 data/0_8/high_level_api/ct1.bcode create mode 100644 data/0_8/high_level_api/ct1.cbor create mode 100644 data/0_8/high_level_api/ct1_signed.bcode create mode 100644 data/0_8/high_level_api/ct1_signed.cbor create mode 100644 data/0_8/high_level_api/ct2.bcode create mode 100644 data/0_8/high_level_api/ct2.cbor create mode 100644 data/0_8/high_level_api/ct2_signed.bcode create mode 100644 data/0_8/high_level_api/ct2_signed.cbor create mode 100644 data/0_8/high_level_api/ct_compressed_modswitched.bcode create mode 100644 data/0_8/high_level_api/ct_compressed_modswitched.cbor create mode 100644 data/0_8/high_level_api/ct_compressed_modswitched_signed.bcode create mode 100644 data/0_8/high_level_api/ct_compressed_modswitched_signed.cbor create mode 100644 data/0_8/high_level_api/ct_compressed_seeded.bcode create mode 100644 data/0_8/high_level_api/ct_compressed_seeded.cbor create mode 100644 data/0_8/high_level_api/ct_compressed_seeded_signed.bcode create mode 100644 data/0_8/high_level_api/ct_compressed_seeded_signed.cbor create mode 100644 data/0_8/high_level_api/hl_compressed_heterogeneous_list.bcode create mode 100644 data/0_8/high_level_api/hl_compressed_heterogeneous_list.cbor create mode 100644 data/0_8/high_level_api/hl_heterogeneous_list.bcode create mode 100644 data/0_8/high_level_api/hl_heterogeneous_list.cbor create mode 100644 data/0_8/high_level_api/hl_packed_heterogeneous_list.bcode create mode 100644 data/0_8/high_level_api/hl_packed_heterogeneous_list.cbor delete mode 100644 data/0_8/high_level_api/hl_proven_packed_heterogeneous_list.bcode delete mode 100644 data/0_8/high_level_api/hl_proven_packed_heterogeneous_list.cbor create mode 100644 data/0_8/high_level_api/legacy_public_key.bcode create mode 100644 data/0_8/high_level_api/legacy_public_key.cbor create mode 100644 data/0_8/high_level_api/server_key.bcode create mode 100644 data/0_8/high_level_api/server_key.cbor create mode 100644 data/0_8/high_level_api/server_key_with_compression.bcode create mode 100644 data/0_8/high_level_api/server_key_with_compression.cbor rename data/{0_6 => 0_8}/shortint/client_key.bcode (100%) rename data/{0_6 => 0_8}/shortint/client_key.cbor (100%) rename data/{0_6 => 0_8}/shortint/ct1.bcode (100%) rename data/{0_6 => 0_8}/shortint/ct1.cbor (100%) rename data/{0_6 => 0_8}/shortint/ct2.bcode (100%) rename data/{0_6 => 0_8}/shortint/ct2.cbor (100%) create mode 100644 data/0_9/high_level_api/client_key.bcode create mode 100644 data/0_9/high_level_api/client_key.cbor create mode 100644 data/0_9/high_level_api/compressed_server_key.bcode create mode 100644 data/0_9/high_level_api/compressed_server_key.cbor delete mode 100644 src/data_0_6.rs delete mode 100644 src/data_0_7.rs create mode 100644 src/data_0_9.rs diff --git a/.github/workflows/cargo_build.yml b/.github/workflows/cargo_build.yml index cad54aa..09c83f8 100644 --- a/.github/workflows/cargo_build.yml +++ b/.github/workflows/cargo_build.yml @@ -34,4 +34,4 @@ jobs: - name: Run clippy run: | - cargo clippy --all-features + cargo clippy --all-features -- --no-deps -D warnings diff --git a/Cargo.lock b/Cargo.lock index acf2a2c..fc4a971 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -215,17 +215,13 @@ dependencies = [ ] [[package]] -name = "concrete-fft" +name = "concrete-csprng" version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3144f883422ee22c65d4f408c11b3406513eadc0d50b3d65bfadcb97852817e0" +source = "git+https://github.com/zama-ai/tfhe-rs/?branch=am/chore/make-ks-level-order-consistent#c0170065b2201e57b84a8588ff0c8210c267d113" dependencies = [ - "aligned-vec", - "bytemuck", - "dyn-stack 0.9.1", - "num-complex", - "pulp", - "serde", + "aes", + "libc", + "rayon", ] [[package]] @@ -236,23 +232,13 @@ checksum = "86ff7397e00e903afb03f0adca6a5f3bec3a6e96a7cdb70bdc088e01b125e170" dependencies = [ "aligned-vec", "bytemuck", - "dyn-stack 0.10.0", + "dyn-stack", "js-sys", "num-complex", "pulp", "serde", ] -[[package]] -name = "concrete-ntt" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4f4643dbd5de069e099122ae6c2bbd3db70d69ffec348dfc228448d635f949e" -dependencies = [ - "aligned-vec", - "pulp", -] - [[package]] name = "concrete-ntt" version = "0.2.0" @@ -334,16 +320,6 @@ dependencies = [ "crypto-common", ] -[[package]] -name = "dyn-stack" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe7f8d7bcc523381d3c437b82cf74805de3931de0da69309ae0fe1bdf7a256e" -dependencies = [ - "bytemuck", - "reborrow", -] - [[package]] name = "dyn-stack" version = "0.10.0" @@ -454,9 +430,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.159" +version = "0.2.160" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" +checksum = "f0b21006cd1874ae9e650973c565615676dc4a274c965bb0a73796dac838ce4f" [[package]] name = "libm" @@ -532,9 +508,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.87" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a" +checksum = "7c3a7fc5db1e57d5a779a352c8cdb57b29aa4c40cc69c3a68a7fedc815fbf2f9" dependencies = [ "unicode-ident", ] @@ -716,38 +692,17 @@ dependencies = [ [[package]] name = "tfhe" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef19c00c4aceea2d103524911ee840fdcdd1376b1946c5b103b5c094a039f160" -dependencies = [ - "aligned-vec", - "bincode", - "bytemuck", - "concrete-csprng", - "concrete-fft 0.4.1", - "dyn-stack 0.9.1", - "itertools 0.11.0", - "paste", - "pulp", - "rand_core", - "rayon", - "serde", - "tfhe-versionable 0.1.0", -] - -[[package]] -name = "tfhe" -version = "0.7.2" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0623aaa0dc7836f4f7aa96602ef9c6a55f87cbcb962a94ed7a9e6d00daa32cfb" +checksum = "e4504375366bae25ff025c6bc19ee6272347121147581aa0fd36c7fc20ab6600" dependencies = [ "aligned-vec", "bincode", "bytemuck", - "concrete-csprng", - "concrete-fft 0.4.1", - "concrete-ntt 0.1.2", - "dyn-stack 0.9.1", + "concrete-csprng 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "concrete-fft", + "concrete-ntt", + "dyn-stack", "itertools 0.11.0", "paste", "pulp", @@ -755,22 +710,22 @@ dependencies = [ "rayon", "serde", "sha3", - "tfhe-versionable 0.2.1", + "tfhe-versionable 0.3.1", + "tfhe-zk-pok 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tfhe" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b2e12b38d4a0538191287f31130712a7424f3aed6b922f4d9c4f51a5b7f4cc0" +version = "0.9.0" +source = "git+https://github.com/zama-ai/tfhe-rs/?branch=am/chore/make-ks-level-order-consistent#c0170065b2201e57b84a8588ff0c8210c267d113" dependencies = [ "aligned-vec", "bincode", "bytemuck", - "concrete-csprng", - "concrete-fft 0.5.1", - "concrete-ntt 0.2.0", - "dyn-stack 0.10.0", + "concrete-csprng 0.4.1 (git+https://github.com/zama-ai/tfhe-rs/?branch=am/chore/make-ks-level-order-consistent)", + "concrete-fft", + "concrete-ntt", + "dyn-stack", "itertools 0.11.0", "paste", "pulp", @@ -778,8 +733,8 @@ dependencies = [ "rayon", "serde", "sha3", - "tfhe-versionable 0.3.1", - "tfhe-zk-pok", + "tfhe-versionable 0.3.2", + "tfhe-zk-pok 0.3.0 (git+https://github.com/zama-ai/tfhe-rs/?branch=am/chore/make-ks-level-order-consistent)", ] [[package]] @@ -859,55 +814,40 @@ dependencies = [ "semver", "serde", "strum", - "tfhe 0.6.4", - "tfhe 0.7.2", - "tfhe 0.8.3", - "tfhe-versionable 0.1.0", - "tfhe-versionable 0.2.1", + "tfhe 0.8.4", + "tfhe 0.9.0", "tfhe-versionable 0.3.1", + "tfhe-versionable 0.3.2", ] [[package]] name = "tfhe-versionable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7977829d8b2d59a16d9780ffbf8e4084a8d67f32c0e557b647136d094d391b2" -dependencies = [ - "aligned-vec", - "num-complex", - "serde", - "tfhe-versionable-derive 0.1.0", -] - -[[package]] -name = "tfhe-versionable" -version = "0.2.1" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c7f9c9ef59d138c8ee539da0e15daf73345f0969a718f48bfd78706e4948e92" +checksum = "feeb340d850c65660b321e5379a28b2f3b226c61163de0a12766aedfe8575a29" dependencies = [ "aligned-vec", "num-complex", "serde", - "tfhe-versionable-derive 0.2.1", + "tfhe-versionable-derive 0.3.1", ] [[package]] name = "tfhe-versionable" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feeb340d850c65660b321e5379a28b2f3b226c61163de0a12766aedfe8575a29" +version = "0.3.2" +source = "git+https://github.com/zama-ai/tfhe-rs/?branch=am/chore/make-ks-level-order-consistent#c0170065b2201e57b84a8588ff0c8210c267d113" dependencies = [ "aligned-vec", "num-complex", "serde", - "tfhe-versionable-derive 0.3.1", + "tfhe-versionable-derive 0.3.2", ] [[package]] name = "tfhe-versionable-derive" -version = "0.1.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "754aede9c522d81d852b46714d42137d307f418b8b6eed4db03d1466080f4f9d" +checksum = "01d985f9645ed62be4aefb9c06ec70563291ec475036ebcd2cf95c5429a12e8a" dependencies = [ "proc-macro2", "quote", @@ -916,9 +856,8 @@ dependencies = [ [[package]] name = "tfhe-versionable-derive" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4709d2c6e0a39b45ed752f4b1151e261cc43c9681cacad00be4ecfc5df655e5c" +version = "0.3.2" +source = "git+https://github.com/zama-ai/tfhe-rs/?branch=am/chore/make-ks-level-order-consistent#c0170065b2201e57b84a8588ff0c8210c267d113" dependencies = [ "proc-macro2", "quote", @@ -926,21 +865,28 @@ dependencies = [ ] [[package]] -name = "tfhe-versionable-derive" -version = "0.3.1" +name = "tfhe-zk-pok" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01d985f9645ed62be4aefb9c06ec70563291ec475036ebcd2cf95c5429a12e8a" +checksum = "9978204def8b8549b8ed160b983071781726884f2bd9401eeebe951b997cb185" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.79", + "num-bigint", + "rand", + "rayon", + "serde", + "sha3", + "tfhe-ark-bls12-381", + "tfhe-ark-ec", + "tfhe-ark-ff", + "tfhe-ark-poly", + "tfhe-versionable 0.3.1", + "zeroize", ] [[package]] name = "tfhe-zk-pok" version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9978204def8b8549b8ed160b983071781726884f2bd9401eeebe951b997cb185" +source = "git+https://github.com/zama-ai/tfhe-rs/?branch=am/chore/make-ks-level-order-consistent#c0170065b2201e57b84a8588ff0c8210c267d113" dependencies = [ "num-bigint", "rand", @@ -951,7 +897,7 @@ dependencies = [ "tfhe-ark-ec", "tfhe-ark-ff", "tfhe-ark-poly", - "tfhe-versionable 0.3.1", + "tfhe-versionable 0.3.2", "zeroize", ] diff --git a/Cargo.toml b/Cargo.toml index 525aa6c..fe8bff7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,32 +9,25 @@ edition = "2021" [dependencies] # This is a list of tfhe-rs versions we will generate data for. This list will grow over time. # They are only activated when generating data, with the binary target and the "generate" feature. -tfhe_0_6 = { version = "0.6", features = [ - "boolean", - "integer", - "shortint", - "x86_64-unix", - "experimental-force_fft_algo_dif4", -], package = "tfhe", optional = true } -tfhe_0_7 = { version = "0.7", features = [ +tfhe_0_8 = { version = "0.8", features = [ "boolean", "integer", "shortint", "x86_64-unix", + "zk-pok", "experimental-force_fft_algo_dif4", ], package = "tfhe", optional = true } -tfhe_0_8 = { version = "0.8", features = [ +tfhe_0_9 = { version = "0.9", features = [ "boolean", "integer", "shortint", "x86_64-unix", "zk-pok", "experimental-force_fft_algo_dif4", -], package = "tfhe", optional = true } +], package = "tfhe", optional = true, git = "https://github.com/zama-ai/tfhe-rs/", branch = "am/chore/make-ks-level-order-consistent" } -tfhe-versionable_0_1 = { version = "0.1", optional = true, package = "tfhe-versionable" } -tfhe-versionable_0_2 = { version = "0.2", optional = true, package = "tfhe-versionable" } -tfhe-versionable_0_3 = { version = "0.3", optional = true, package = "tfhe-versionable" } +tfhe_0_8-versionable = { version = "0.3", optional = true, package = "tfhe-versionable" } +tfhe_0_9-versionable = { version = "0.3", optional = true, package = "tfhe-versionable", git = "https://github.com/zama-ai/tfhe-rs/", branch = "am/chore/make-ks-level-order-consistent" } # other deps serde = { version = "1.0", features = ["derive"] } @@ -52,11 +45,9 @@ required-features = ["generate"] default = ["generate"] generate = [ - "dep:tfhe_0_6", - "dep:tfhe_0_7", "dep:tfhe_0_8", - "dep:tfhe-versionable_0_1", - "dep:tfhe-versionable_0_2", - "dep:tfhe-versionable_0_3", + "dep:tfhe_0_9", + "dep:tfhe_0_8-versionable", + "dep:tfhe_0_9-versionable", ] load = ["dep:semver"] diff --git a/data/0_6/high_level_api/bool1.bcode b/data/0_6/high_level_api/bool1.bcode deleted file mode 100644 index e958e23..0000000 --- a/data/0_6/high_level_api/bool1.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ac53d91ded3b510dc7362c80f6d992a87599ae52c182025308cb3812f0bd5e74 -size 16504 diff --git a/data/0_6/high_level_api/bool1.cbor b/data/0_6/high_level_api/bool1.cbor deleted file mode 100644 index b153a90..0000000 --- a/data/0_6/high_level_api/bool1.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8d814289a9a76e707edd7aa57f95a4a9dd7c88de413fdbc27797cccc9fd602a9 -size 18635 diff --git a/data/0_6/high_level_api/bool2.bcode b/data/0_6/high_level_api/bool2.bcode deleted file mode 100644 index bce0511..0000000 --- a/data/0_6/high_level_api/bool2.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0668d74e49a7466f91058c08c7ced46e961e58a4227b9de3034bccf917e0f49a -size 16504 diff --git a/data/0_6/high_level_api/bool2.cbor b/data/0_6/high_level_api/bool2.cbor deleted file mode 100644 index 8edecaf..0000000 --- a/data/0_6/high_level_api/bool2.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:47bb71f0e86be608d97d6761d4a0ee42828e7fcba582421a776a4331c1d26a76 -size 18635 diff --git a/data/0_6/high_level_api/bool_list.bcode b/data/0_6/high_level_api/bool_list.bcode deleted file mode 100644 index 473271c..0000000 --- a/data/0_6/high_level_api/bool_list.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1ca95aeec6eed73b9e26197c2d45eb9764caeaf8e44723e2f7f8921be07892f3 -size 16548 diff --git a/data/0_6/high_level_api/bool_list.cbor b/data/0_6/high_level_api/bool_list.cbor deleted file mode 100644 index cb1e3d4..0000000 --- a/data/0_6/high_level_api/bool_list.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:189dc0a6d7680fe945a53050360befa356f44cbc97feeecf2e09205898b247c7 -size 18723 diff --git a/data/0_6/high_level_api/client_key.bcode b/data/0_6/high_level_api/client_key.bcode deleted file mode 100644 index e39513a..0000000 --- a/data/0_6/high_level_api/client_key.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3149cbea56a54e109768a5f0ce84d71194b65d7f0613dd47c0754aa7eec5f494 -size 22769 diff --git a/data/0_6/high_level_api/client_key.cbor b/data/0_6/high_level_api/client_key.cbor deleted file mode 100644 index 969fc94..0000000 --- a/data/0_6/high_level_api/client_key.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:48cfec03f020b939b16887580a5fc8388d1a16479336a156de8ef11554ddbc27 -size 3408 diff --git a/data/0_6/high_level_api/client_key_for_pubkey.bcode b/data/0_6/high_level_api/client_key_for_pubkey.bcode deleted file mode 100644 index f52f7ff..0000000 --- a/data/0_6/high_level_api/client_key_for_pubkey.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ffbada52d0170757a1120103154362cea9eea76feae35cad51fa230532dd8426 -size 12665 diff --git a/data/0_6/high_level_api/client_key_for_pubkey.cbor b/data/0_6/high_level_api/client_key_for_pubkey.cbor deleted file mode 100644 index f89a978..0000000 --- a/data/0_6/high_level_api/client_key_for_pubkey.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a74ebb091eb22724eb37ab3561dfe3e3bee69d44e3597bbf5b8c2a3c21c38b79 -size 2143 diff --git a/data/0_6/high_level_api/compact_bool.bcode b/data/0_6/high_level_api/compact_bool.bcode deleted file mode 100644 index 372b441..0000000 --- a/data/0_6/high_level_api/compact_bool.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1a41a08aff7b4e65de1d369cc48513eb800c47435addc26c9524eee755a820c9 -size 16532 diff --git a/data/0_6/high_level_api/compact_bool.cbor b/data/0_6/high_level_api/compact_bool.cbor deleted file mode 100644 index 0500688..0000000 --- a/data/0_6/high_level_api/compact_bool.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:497b7e18679810eedc29b96a71c8af678a057675b1a1208517e3d822927f0b8d -size 18705 diff --git a/data/0_6/high_level_api/compact_public_key.bcode b/data/0_6/high_level_api/compact_public_key.bcode deleted file mode 100644 index 30ed8ad..0000000 --- a/data/0_6/high_level_api/compact_public_key.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b4cceb6a1c20679098278a704e820cb729c8a5a166d68b2105310ab9e946fbe7 -size 33092 diff --git a/data/0_6/high_level_api/compact_public_key.cbor b/data/0_6/high_level_api/compact_public_key.cbor deleted file mode 100644 index 4be2ce3..0000000 --- a/data/0_6/high_level_api/compact_public_key.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2137435633c1bf2fc361996a5ca5e17777136f70b9b96c09561ad20b4de65650 -size 37500 diff --git a/data/0_6/high_level_api/compressed_compact_public_key.bcode b/data/0_6/high_level_api/compressed_compact_public_key.bcode deleted file mode 100644 index 86a9187..0000000 --- a/data/0_6/high_level_api/compressed_compact_public_key.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d27295bf5479ad0a96b05f64852c5fab996ca1be90c33bd5031ee15c113bfd70 -size 16728 diff --git a/data/0_6/high_level_api/compressed_compact_public_key.cbor b/data/0_6/high_level_api/compressed_compact_public_key.cbor deleted file mode 100644 index d032882..0000000 --- a/data/0_6/high_level_api/compressed_compact_public_key.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c61223df3cd7bd43490759ff947836933916b89fa2799495940c8b04d2fbcc5f -size 19112 diff --git a/data/0_6/high_level_api/compressed_modswitched_bool.bcode b/data/0_6/high_level_api/compressed_modswitched_bool.bcode deleted file mode 100644 index 26cf92d..0000000 --- a/data/0_6/high_level_api/compressed_modswitched_bool.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e5b8f4278c94fced9714dbf83621d65a93bc86a68a6c451ae279edbb2ca6a457 -size 140 diff --git a/data/0_6/high_level_api/compressed_modswitched_bool.cbor b/data/0_6/high_level_api/compressed_modswitched_bool.cbor deleted file mode 100644 index 9a15327..0000000 --- a/data/0_6/high_level_api/compressed_modswitched_bool.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:99ce348bbdf2f35ed45acfea55207d961fd8cfa89d73dc52266f957bbd3f5ea2 -size 249 diff --git a/data/0_6/high_level_api/compressed_public_key.bcode b/data/0_6/high_level_api/compressed_public_key.bcode deleted file mode 100644 index 5911db0..0000000 --- a/data/0_6/high_level_api/compressed_public_key.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1b78c2ca9f65cc85a6da8f9b005b406c6ba90732292b2552408f5176da9d650b -size 1050452 diff --git a/data/0_6/high_level_api/compressed_public_key.cbor b/data/0_6/high_level_api/compressed_public_key.cbor deleted file mode 100644 index 7547d59..0000000 --- a/data/0_6/high_level_api/compressed_public_key.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3d39037023a3ee996454187520b66a549c106afe024f4bacd3382dc9406deaa3 -size 1182047 diff --git a/data/0_6/high_level_api/compressed_seeded_bool.bcode b/data/0_6/high_level_api/compressed_seeded_bool.bcode deleted file mode 100644 index 9b45f8e..0000000 --- a/data/0_6/high_level_api/compressed_seeded_bool.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:3554d5b5b230b3430983452481ca9a4c6fbd766b7a65e6203fedb4fcd640107b -size 140 diff --git a/data/0_6/high_level_api/compressed_seeded_bool.cbor b/data/0_6/high_level_api/compressed_seeded_bool.cbor deleted file mode 100644 index 46bca92..0000000 --- a/data/0_6/high_level_api/compressed_seeded_bool.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2f2dbb5bcff6b36a8a104cfcad8ffc6bf1ea29b3aa85ff323236c22631a9a1bb -size 249 diff --git a/data/0_6/high_level_api/compressed_server_key.bcode b/data/0_6/high_level_api/compressed_server_key.bcode deleted file mode 100644 index 48a84ae..0000000 --- a/data/0_6/high_level_api/compressed_server_key.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b924bb307963ab67e36ded02e3edd6a8ca1685102458ec5129b8af95eb15a98b -size 25018684 diff --git a/data/0_6/high_level_api/compressed_server_key.cbor b/data/0_6/high_level_api/compressed_server_key.cbor deleted file mode 100644 index 47ea8a5..0000000 --- a/data/0_6/high_level_api/compressed_server_key.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:292a31f601d833fd2d69c282df687c3cbf4d3a97fdb8669335d63650ca180d30 -size 28146288 diff --git a/data/0_6/high_level_api/ct1.bcode b/data/0_6/high_level_api/ct1.bcode deleted file mode 100644 index efcf4a0..0000000 --- a/data/0_6/high_level_api/ct1.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:46f8e414ca7a952a0162d8358d8f9c36ea02ed6dca5ecb476c71e75b358287b8 -size 65988 diff --git a/data/0_6/high_level_api/ct1.cbor b/data/0_6/high_level_api/ct1.cbor deleted file mode 100644 index 8719209..0000000 --- a/data/0_6/high_level_api/ct1.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e5e95b6f78b73b231690986557a4b954dd8660a14e8a2114f3839bb887923369 -size 74481 diff --git a/data/0_6/high_level_api/ct1_signed.bcode b/data/0_6/high_level_api/ct1_signed.bcode deleted file mode 100644 index 602181d..0000000 --- a/data/0_6/high_level_api/ct1_signed.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a65aa8a2c1c632fdc350f3dfed8cb73e9972040719249985dbe0b851ae8c14a8 -size 65988 diff --git a/data/0_6/high_level_api/ct1_signed.cbor b/data/0_6/high_level_api/ct1_signed.cbor deleted file mode 100644 index a85e186..0000000 --- a/data/0_6/high_level_api/ct1_signed.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:48a5b384e4e856951ae4b383e579eb6e1f01f48db03a72ee47373a873e2ef706 -size 74481 diff --git a/data/0_6/high_level_api/ct2.bcode b/data/0_6/high_level_api/ct2.bcode deleted file mode 100644 index a174a7b..0000000 --- a/data/0_6/high_level_api/ct2.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b751c1c93ecdff35919e4a7ea7597d1e33d468b6d48ca061461a788bce97accf -size 65988 diff --git a/data/0_6/high_level_api/ct2.cbor b/data/0_6/high_level_api/ct2.cbor deleted file mode 100644 index 72941e3..0000000 --- a/data/0_6/high_level_api/ct2.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5f3ffec7c2d2e30c12a262751d498b49c79eb3e78a21eddb423a59047ca9dd66 -size 74481 diff --git a/data/0_6/high_level_api/ct2_signed.bcode b/data/0_6/high_level_api/ct2_signed.bcode deleted file mode 100644 index 5c5d4ac..0000000 --- a/data/0_6/high_level_api/ct2_signed.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:6d7fc262410975d0aaff76c84040df6fc2c2b20c87b885fa2fe23a0fa41b63c5 -size 65988 diff --git a/data/0_6/high_level_api/ct2_signed.cbor b/data/0_6/high_level_api/ct2_signed.cbor deleted file mode 100644 index eea3e74..0000000 --- a/data/0_6/high_level_api/ct2_signed.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2a4cdead7a5d2030daf54c1d446770d90128a29428a7479129c622c7c0cff4c4 -size 74481 diff --git a/data/0_6/high_level_api/ct_compact.bcode b/data/0_6/high_level_api/ct_compact.bcode deleted file mode 100644 index b10f2fb..0000000 --- a/data/0_6/high_level_api/ct_compact.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:101fa833cccd1aa7de156b4752380d40770a276927fd5735576671f64a2867cc -size 16556 diff --git a/data/0_6/high_level_api/ct_compact.cbor b/data/0_6/high_level_api/ct_compact.cbor deleted file mode 100644 index b02d755..0000000 --- a/data/0_6/high_level_api/ct_compact.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:695d0b556bc3d6f648a2dbcd8f70da3189693f8652bcfbacb97e26f9fb8137b8 -size 18736 diff --git a/data/0_6/high_level_api/ct_compact_signed.bcode b/data/0_6/high_level_api/ct_compact_signed.bcode deleted file mode 100644 index 87aee23..0000000 --- a/data/0_6/high_level_api/ct_compact_signed.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:25ae5790420aebfe981e6988fac8b8765224df1c8088f5435b840757162409aa -size 16556 diff --git a/data/0_6/high_level_api/ct_compact_signed.cbor b/data/0_6/high_level_api/ct_compact_signed.cbor deleted file mode 100644 index f993997..0000000 --- a/data/0_6/high_level_api/ct_compact_signed.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:69b4c424d980051158144e0d324a8c47e0db2b9cf09c42850fc5ce63c943c7ac -size 18736 diff --git a/data/0_6/high_level_api/ct_compressed_modswitched.bcode b/data/0_6/high_level_api/ct_compressed_modswitched.bcode deleted file mode 100644 index e7bb92b..0000000 --- a/data/0_6/high_level_api/ct_compressed_modswitched.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:fed8804456b9d115c890f967cc20e1cbfbe8ab6f7243e9365f5d062d92415567 -size 5048 diff --git a/data/0_6/high_level_api/ct_compressed_modswitched.cbor b/data/0_6/high_level_api/ct_compressed_modswitched.cbor deleted file mode 100644 index 47d9025..0000000 --- a/data/0_6/high_level_api/ct_compressed_modswitched.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e5f01758c84c31f4287a93a99022046808fc0d01bd5007bad4e0674969c0a5f3 -size 6218 diff --git a/data/0_6/high_level_api/ct_compressed_modswitched_signed.bcode b/data/0_6/high_level_api/ct_compressed_modswitched_signed.bcode deleted file mode 100644 index eb1c5cc..0000000 --- a/data/0_6/high_level_api/ct_compressed_modswitched_signed.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:642a4c9b1f26832c4ebe96c75c4b5352388c73b61c78badfb9bebfbc44ecc074 -size 5048 diff --git a/data/0_6/high_level_api/ct_compressed_modswitched_signed.cbor b/data/0_6/high_level_api/ct_compressed_modswitched_signed.cbor deleted file mode 100644 index 9245c54..0000000 --- a/data/0_6/high_level_api/ct_compressed_modswitched_signed.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:682c2ff216bff8b8e92fcce5aa1147466917b234bc6ab4640fee782aad2ceb61 -size 6218 diff --git a/data/0_6/high_level_api/ct_compressed_seeded.bcode b/data/0_6/high_level_api/ct_compressed_seeded.bcode deleted file mode 100644 index bf441b6..0000000 --- a/data/0_6/high_level_api/ct_compressed_seeded.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:e1f27f7c0bd7074b3355c3db2de921d6f3ee4496f8204967d8ebcad010ba8ea9 -size 552 diff --git a/data/0_6/high_level_api/ct_compressed_seeded.cbor b/data/0_6/high_level_api/ct_compressed_seeded.cbor deleted file mode 100644 index 5bbb8d5..0000000 --- a/data/0_6/high_level_api/ct_compressed_seeded.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:439e044835a8dd5584ac5a5dbe510cdb2f77233575b5cfd74d41dab2d8d80511 -size 993 diff --git a/data/0_6/high_level_api/ct_compressed_seeded_signed.bcode b/data/0_6/high_level_api/ct_compressed_seeded_signed.bcode deleted file mode 100644 index aa1c0b6..0000000 --- a/data/0_6/high_level_api/ct_compressed_seeded_signed.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c273054b9689cf4c469e5df137d3a0d83a562fc4f36f18fa5799af9bd00c1f2e -size 552 diff --git a/data/0_6/high_level_api/ct_compressed_seeded_signed.cbor b/data/0_6/high_level_api/ct_compressed_seeded_signed.cbor deleted file mode 100644 index d2b9b43..0000000 --- a/data/0_6/high_level_api/ct_compressed_seeded_signed.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:57ba6e372d582ec36e0b599125006d145bbb62de20247ef0d4fbfcc953361fc2 -size 993 diff --git a/data/0_6/high_level_api/ct_list.bcode b/data/0_6/high_level_api/ct_list.bcode deleted file mode 100644 index 74f1c92..0000000 --- a/data/0_6/high_level_api/ct_list.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:fb2f3ab57df47b548521d24f3db67a6788bc49cdba7bc2bbe6aac81e97e77c8c -size 16588 diff --git a/data/0_6/high_level_api/ct_list.cbor b/data/0_6/high_level_api/ct_list.cbor deleted file mode 100644 index 2e5a4e0..0000000 --- a/data/0_6/high_level_api/ct_list.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:dd73bf2d352075e54e72556280976d64a878b1b95826d5658ac1392b176d200d -size 18772 diff --git a/data/0_6/high_level_api/ct_list_signed.bcode b/data/0_6/high_level_api/ct_list_signed.bcode deleted file mode 100644 index 01090c5..0000000 --- a/data/0_6/high_level_api/ct_list_signed.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d7f56df5184b0295201f02d2b8d3ed0b1dbcc14ed76608b8218204ebdad8ef01 -size 16620 diff --git a/data/0_6/high_level_api/ct_list_signed.cbor b/data/0_6/high_level_api/ct_list_signed.cbor deleted file mode 100644 index fb9430f..0000000 --- a/data/0_6/high_level_api/ct_list_signed.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:069c3239d0730125794349e34b87a984e545126c6f05494593253573c5c42513 -size 18808 diff --git a/data/0_6/high_level_api/public_key.bcode b/data/0_6/high_level_api/public_key.bcode deleted file mode 100644 index 89149ed..0000000 --- a/data/0_6/high_level_api/public_key.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d6b9c751a0b4f7befba57b17a5825e8d08a6e9aa4cbb5af59bdb555e171832d7 -size 73536 diff --git a/data/0_6/high_level_api/public_key.cbor b/data/0_6/high_level_api/public_key.cbor deleted file mode 100644 index 9667746..0000000 --- a/data/0_6/high_level_api/public_key.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7555e0c6f0c56614f07fb2660f7467d060e1823ea0fd170467ca049752803f5b -size 82990 diff --git a/data/0_6/high_level_api/server_key.bcode b/data/0_6/high_level_api/server_key.bcode deleted file mode 100644 index 9f53b3e..0000000 --- a/data/0_6/high_level_api/server_key.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:005497feb4c6476ca66d420df0935c4fd2d575fb70a3f9fa8975a866d8d57d8d -size 112320553 diff --git a/data/0_6/high_level_api/server_key.cbor b/data/0_6/high_level_api/server_key.cbor deleted file mode 100644 index 792b5b7..0000000 --- a/data/0_6/high_level_api/server_key.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a508dd5b7998c698a8183bafe1a5c39e95ce46e2c5f257b0eccb375b966da9ed -size 129459631 diff --git a/data/0_7/high_level_api/client_key.cbor b/data/0_7/high_level_api/client_key.cbor deleted file mode 100644 index 5db721a..0000000 --- a/data/0_7/high_level_api/client_key.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:fa27dc2ea178bc9a55d7f6c5b3a6140c13aa85eece2049d6798d4f4bd0aa9dc5 -size 5075 diff --git a/data/0_7/high_level_api/client_key_with_compression.bcode b/data/0_7/high_level_api/client_key_with_compression.bcode deleted file mode 100644 index 359ab92..0000000 --- a/data/0_7/high_level_api/client_key_with_compression.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9351118470e73eeafb7e106d179ba934362aa35edab8db4339a33ecb651a7f80 -size 33167 diff --git a/data/0_7/high_level_api/client_key_with_compression.cbor b/data/0_7/high_level_api/client_key_with_compression.cbor deleted file mode 100644 index 5db721a..0000000 --- a/data/0_7/high_level_api/client_key_with_compression.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:fa27dc2ea178bc9a55d7f6c5b3a6140c13aa85eece2049d6798d4f4bd0aa9dc5 -size 5075 diff --git a/data/0_7/high_level_api/hl_compressed_heterogeneous_list.bcode b/data/0_7/high_level_api/hl_compressed_heterogeneous_list.bcode deleted file mode 100644 index 3cc0079..0000000 --- a/data/0_7/high_level_api/hl_compressed_heterogeneous_list.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:465b15b89c3161a1dbcebd7f689b5f87f969f15b259c86925ca67d02045f6946 -size 2036 diff --git a/data/0_7/high_level_api/hl_compressed_heterogeneous_list.cbor b/data/0_7/high_level_api/hl_compressed_heterogeneous_list.cbor deleted file mode 100644 index 878d697..0000000 --- a/data/0_7/high_level_api/hl_compressed_heterogeneous_list.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ec9092e4435c434104c518bfc72563b3ec1e2c234d1fb5de94d1a3884d23124e -size 2469 diff --git a/data/0_7/high_level_api/hl_heterogeneous_list.bcode b/data/0_7/high_level_api/hl_heterogeneous_list.bcode deleted file mode 100644 index d8d6d7b..0000000 --- a/data/0_7/high_level_api/hl_heterogeneous_list.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f60cf426e28d96ced5e76157c5ce42d07c1889f542e21b47de33792d3346c5be -size 16660 diff --git a/data/0_7/high_level_api/hl_heterogeneous_list.cbor b/data/0_7/high_level_api/hl_heterogeneous_list.cbor deleted file mode 100644 index b19fbc6..0000000 --- a/data/0_7/high_level_api/hl_heterogeneous_list.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:22ff1f7b7132bd01185b5e11bf68b8275068e82d061c2125f71112868ee42b19 -size 18834 diff --git a/data/0_7/high_level_api/hl_packed_heterogeneous_list.bcode b/data/0_7/high_level_api/hl_packed_heterogeneous_list.bcode deleted file mode 100644 index 8ac35c3..0000000 --- a/data/0_7/high_level_api/hl_packed_heterogeneous_list.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:372afc2ab7c0fbd458f4132a52f9e618896a1700d8d01f5f89da8ce2e784835f -size 16620 diff --git a/data/0_7/high_level_api/hl_packed_heterogeneous_list.cbor b/data/0_7/high_level_api/hl_packed_heterogeneous_list.cbor deleted file mode 100644 index e957f31..0000000 --- a/data/0_7/high_level_api/hl_packed_heterogeneous_list.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9001e41fe1d8053fad71cace70963aee0eb09358ce1497f5d9c6a8259d0433eb -size 18789 diff --git a/data/0_7/high_level_api/server_key_with_compression.bcode b/data/0_7/high_level_api/server_key_with_compression.bcode deleted file mode 100644 index cfa2b70..0000000 --- a/data/0_7/high_level_api/server_key_with_compression.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f466228bda0eb39feb4dd285355a8447ab40540dc7255167f3b706e4cd0a0e57 -size 246579464 diff --git a/data/0_7/high_level_api/server_key_with_compression.cbor b/data/0_7/high_level_api/server_key_with_compression.cbor deleted file mode 100644 index ca328f2..0000000 --- a/data/0_7/high_level_api/server_key_with_compression.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7685373d5af746ad42e85a9517772abfbb1c47ec8275c4510a79d2ece2eefd80 -size 285713294 diff --git a/data/0_8/high_level_api/batch_1_client_key.bcode b/data/0_8/high_level_api/batch_1_client_key.bcode new file mode 100644 index 0000000..28fc5b8 --- /dev/null +++ b/data/0_8/high_level_api/batch_1_client_key.bcode @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:146d966218f0f778b9293839215a232e141ec0199779425660229ab98028b805 +size 23766 diff --git a/data/0_8/high_level_api/batch_1_client_key.cbor b/data/0_8/high_level_api/batch_1_client_key.cbor new file mode 100644 index 0000000..8eac2cd --- /dev/null +++ b/data/0_8/high_level_api/batch_1_client_key.cbor @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:47a478a96630436611d31d6a79c0bde8749a980d99a079af60b5e4e9c37cdc6d +size 3578 diff --git a/data/0_8/high_level_api/batch_2_client_key.cbor b/data/0_8/high_level_api/batch_2_client_key.cbor new file mode 100644 index 0000000..20cef2d --- /dev/null +++ b/data/0_8/high_level_api/batch_2_client_key.cbor @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:71db61e78f0d276e865346970bd8deea122e0f46e195a7ac274bdc3c05d3dd42 +size 4950 diff --git a/data/0_8/high_level_api/bool1.bcode b/data/0_8/high_level_api/bool1.bcode new file mode 100644 index 0000000..89a3512 --- /dev/null +++ b/data/0_8/high_level_api/bool1.bcode @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cc7a4ab83002e4683189ad424287d76ff56c5ff1d840cd837f8164ab9f51f73f +size 16516 diff --git a/data/0_8/high_level_api/bool1.cbor b/data/0_8/high_level_api/bool1.cbor new file mode 100644 index 0000000..843e447 --- /dev/null +++ b/data/0_8/high_level_api/bool1.cbor @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ea98b569589885bebb74328e59b085d785370b4df15bd0292acf301de90db03c +size 18651 diff --git a/data/0_8/high_level_api/bool2.bcode b/data/0_8/high_level_api/bool2.bcode new file mode 100644 index 0000000..4174009 --- /dev/null +++ b/data/0_8/high_level_api/bool2.bcode @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dd15a41d66f3e31fbe22cae273923faa3490388337262b1e177bfc7d47cade54 +size 16516 diff --git a/data/0_8/high_level_api/bool2.cbor b/data/0_8/high_level_api/bool2.cbor new file mode 100644 index 0000000..17ec648 --- /dev/null +++ b/data/0_8/high_level_api/bool2.cbor @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:368460a46dd08f30a9bf9d86832fe250f419e8dbbe4c77e7581e22c7529836a8 +size 18651 diff --git a/data/0_8/high_level_api/client_key.cbor b/data/0_8/high_level_api/client_key.cbor deleted file mode 100644 index 3039761..0000000 --- a/data/0_8/high_level_api/client_key.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0665c8fd54940bb07b3b77520666840c8b5c24be1e5a09ba45bdedb1c064dc72 -size 3578 diff --git a/data/0_8/high_level_api/client_key_for_pubkey.cbor b/data/0_8/high_level_api/client_key_for_pubkey.cbor new file mode 100644 index 0000000..53dc2a6 --- /dev/null +++ b/data/0_8/high_level_api/client_key_for_pubkey.cbor @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:bf4b2e7f41739279478ef97b66c3b6ecc31d18579d9124c644893e8551f4ee68 +size 2696 diff --git a/data/0_8/high_level_api/client_key_with_compression.bcode b/data/0_8/high_level_api/client_key_with_compression.bcode new file mode 100644 index 0000000..6a8312b --- /dev/null +++ b/data/0_8/high_level_api/client_key_with_compression.bcode @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a151f56655e58ba7acda326e95eea7a7189f116f59641de6c049b8e3047092a9 +size 32106 diff --git a/data/0_8/high_level_api/client_key_with_compression.cbor b/data/0_8/high_level_api/client_key_with_compression.cbor new file mode 100644 index 0000000..20cef2d --- /dev/null +++ b/data/0_8/high_level_api/client_key_with_compression.cbor @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:71db61e78f0d276e865346970bd8deea122e0f46e195a7ac274bdc3c05d3dd42 +size 4950 diff --git a/data/0_8/high_level_api/compact_public_key.bcode b/data/0_8/high_level_api/compact_public_key.bcode new file mode 100644 index 0000000..8a7c254 --- /dev/null +++ b/data/0_8/high_level_api/compact_public_key.bcode @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:12021e06a8bfc377d88c32a584008bddff31ad54f17b30452af2203bd53f0f0b +size 32952 diff --git a/data/0_8/high_level_api/compact_public_key.cbor b/data/0_8/high_level_api/compact_public_key.cbor new file mode 100644 index 0000000..47ff1ee --- /dev/null +++ b/data/0_8/high_level_api/compact_public_key.cbor @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b976505df0bc4b475bb34636f86acc03a3568644cba96ecaaedb149c179093b9 +size 37281 diff --git a/data/0_8/high_level_api/compressed_compact_public_key.bcode b/data/0_8/high_level_api/compressed_compact_public_key.bcode new file mode 100644 index 0000000..8f3ec02 --- /dev/null +++ b/data/0_8/high_level_api/compressed_compact_public_key.bcode @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0d2cc68b39fc2529bb9115eca21dd7f94c87e2f71a7ca0a9a0c3ceddf4a76a31 +size 16588 diff --git a/data/0_8/high_level_api/compressed_compact_public_key.cbor b/data/0_8/high_level_api/compressed_compact_public_key.cbor new file mode 100644 index 0000000..e8a7126 --- /dev/null +++ b/data/0_8/high_level_api/compressed_compact_public_key.cbor @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2b17d65d770f29860c37967caf803486b4d06ec56ae047b9477277936bcbdda7 +size 18893 diff --git a/data/0_8/high_level_api/compressed_legacy_public_key.bcode b/data/0_8/high_level_api/compressed_legacy_public_key.bcode new file mode 100644 index 0000000..828c3ed --- /dev/null +++ b/data/0_8/high_level_api/compressed_legacy_public_key.bcode @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8aa5e8c7b74078e2a8d86cea8824cfa438974a795da47f5f0d9c4c3c8e865d87 +size 1050440 diff --git a/data/0_8/high_level_api/compressed_legacy_public_key.cbor b/data/0_8/high_level_api/compressed_legacy_public_key.cbor new file mode 100644 index 0000000..f23676b --- /dev/null +++ b/data/0_8/high_level_api/compressed_legacy_public_key.cbor @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:50c30df30f274cb44940049b47515a764dcabfc4d3a4e014222262c500aefa67 +size 1182066 diff --git a/data/0_8/high_level_api/compressed_modswitched_bool.bcode b/data/0_8/high_level_api/compressed_modswitched_bool.bcode new file mode 100644 index 0000000..f9ee4c5 --- /dev/null +++ b/data/0_8/high_level_api/compressed_modswitched_bool.bcode @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4c1bc3c59328d829b8b91fda11b10542066d73502df89a35adcad94770a121eb +size 156 diff --git a/data/0_8/high_level_api/compressed_modswitched_bool.cbor b/data/0_8/high_level_api/compressed_modswitched_bool.cbor new file mode 100644 index 0000000..cdb5f99 --- /dev/null +++ b/data/0_8/high_level_api/compressed_modswitched_bool.cbor @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:840a8de5a8453b4155e6717a8e9726ae9ca205c9849ceafb5eb2d8a5a0dc4c01 +size 276 diff --git a/data/0_8/high_level_api/compressed_seeded_bool.bcode b/data/0_8/high_level_api/compressed_seeded_bool.bcode new file mode 100644 index 0000000..22fec10 --- /dev/null +++ b/data/0_8/high_level_api/compressed_seeded_bool.bcode @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fc5a5a7730bf3c9d88c179b9ac660936da62c36a8f4ec2a4339402ac6f640da2 +size 156 diff --git a/data/0_8/high_level_api/compressed_seeded_bool.cbor b/data/0_8/high_level_api/compressed_seeded_bool.cbor new file mode 100644 index 0000000..b8f9acb --- /dev/null +++ b/data/0_8/high_level_api/compressed_seeded_bool.cbor @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6e6a55d561f1d4e4702944ccfb3f79fd7663fc6ad986b46ee0d508453bcfb9c9 +size 276 diff --git a/data/0_8/high_level_api/ct1.bcode b/data/0_8/high_level_api/ct1.bcode new file mode 100644 index 0000000..6f04788 --- /dev/null +++ b/data/0_8/high_level_api/ct1.bcode @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1fd37585babb5df46a7f3fb59ec40a481ee5bd7997ea26cd0551752ea29119a7 +size 66000 diff --git a/data/0_8/high_level_api/ct1.cbor b/data/0_8/high_level_api/ct1.cbor new file mode 100644 index 0000000..2f3f215 --- /dev/null +++ b/data/0_8/high_level_api/ct1.cbor @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:51c71499c8318d8206206ff7b4e97750c3e2c22e79792c16c20c72b214f45a0f +size 74497 diff --git a/data/0_8/high_level_api/ct1_signed.bcode b/data/0_8/high_level_api/ct1_signed.bcode new file mode 100644 index 0000000..87567e1 --- /dev/null +++ b/data/0_8/high_level_api/ct1_signed.bcode @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9d1b2cf05880a7aaee6cc5eda9d8e6c4a1a7985dbe3a709beb3d47b5514c833f +size 66000 diff --git a/data/0_8/high_level_api/ct1_signed.cbor b/data/0_8/high_level_api/ct1_signed.cbor new file mode 100644 index 0000000..5aecb48 --- /dev/null +++ b/data/0_8/high_level_api/ct1_signed.cbor @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:09f81282b98ac41860ab7629d481e7979a62d834189f7c48c04ebf0d8525e244 +size 74497 diff --git a/data/0_8/high_level_api/ct2.bcode b/data/0_8/high_level_api/ct2.bcode new file mode 100644 index 0000000..c9c4922 --- /dev/null +++ b/data/0_8/high_level_api/ct2.bcode @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cbaf57d728f9061ada49adab6b892283ac26d143ddfe40e5bfd0023042336edd +size 66000 diff --git a/data/0_8/high_level_api/ct2.cbor b/data/0_8/high_level_api/ct2.cbor new file mode 100644 index 0000000..37d0082 --- /dev/null +++ b/data/0_8/high_level_api/ct2.cbor @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6e6dfa851d8a9706ff5ac4c90b1edee3624bf31aea0974cfdd45cf1f75ab7f73 +size 74497 diff --git a/data/0_8/high_level_api/ct2_signed.bcode b/data/0_8/high_level_api/ct2_signed.bcode new file mode 100644 index 0000000..234902a --- /dev/null +++ b/data/0_8/high_level_api/ct2_signed.bcode @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e2fd35aa39145a4dbae4d9eff653724d181074e879256b233982da34b0d1ee16 +size 66000 diff --git a/data/0_8/high_level_api/ct2_signed.cbor b/data/0_8/high_level_api/ct2_signed.cbor new file mode 100644 index 0000000..cecb1fa --- /dev/null +++ b/data/0_8/high_level_api/ct2_signed.cbor @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8821ea05f65efcc6bd67be80ac94ecfe3f4f8fa65992cbe81719c8e01ee48717 +size 74497 diff --git a/data/0_8/high_level_api/ct_compressed_modswitched.bcode b/data/0_8/high_level_api/ct_compressed_modswitched.bcode new file mode 100644 index 0000000..7a66cf6 --- /dev/null +++ b/data/0_8/high_level_api/ct_compressed_modswitched.bcode @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8378a6ce7b70b9e8a9d0b242bfefcf55f4ee1df3fe87ce8d27d18db09c333b4d +size 2977 diff --git a/data/0_8/high_level_api/ct_compressed_modswitched.cbor b/data/0_8/high_level_api/ct_compressed_modswitched.cbor new file mode 100644 index 0000000..c4709a9 --- /dev/null +++ b/data/0_8/high_level_api/ct_compressed_modswitched.cbor @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8d75390fd4fd4484352aa2076019df44a5ceb7c835ab9f6444dbb2dba5e6b268 +size 3697 diff --git a/data/0_8/high_level_api/ct_compressed_modswitched_signed.bcode b/data/0_8/high_level_api/ct_compressed_modswitched_signed.bcode new file mode 100644 index 0000000..044cfc2 --- /dev/null +++ b/data/0_8/high_level_api/ct_compressed_modswitched_signed.bcode @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:716dc0d7ed2d136bbadb21838c99a18697abba0fc50c8f6b6f80dcec9e1ad8b6 +size 2977 diff --git a/data/0_8/high_level_api/ct_compressed_modswitched_signed.cbor b/data/0_8/high_level_api/ct_compressed_modswitched_signed.cbor new file mode 100644 index 0000000..e71df72 --- /dev/null +++ b/data/0_8/high_level_api/ct_compressed_modswitched_signed.cbor @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0f1632b8cda925497a9d90f102fb0292132ffcc2fdad0604896730156ee6ec4f +size 3697 diff --git a/data/0_8/high_level_api/ct_compressed_seeded.bcode b/data/0_8/high_level_api/ct_compressed_seeded.bcode new file mode 100644 index 0000000..1bf9b3e --- /dev/null +++ b/data/0_8/high_level_api/ct_compressed_seeded.bcode @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cc9e04bb4d92d008e01606249b955a0eab037d1d5757c5a37d65c4fd953ec14d +size 564 diff --git a/data/0_8/high_level_api/ct_compressed_seeded.cbor b/data/0_8/high_level_api/ct_compressed_seeded.cbor new file mode 100644 index 0000000..efa752f --- /dev/null +++ b/data/0_8/high_level_api/ct_compressed_seeded.cbor @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9651321b8c4af1bf0df369de4d427e854604ec456131f6c4948fc6a59bedf726 +size 1009 diff --git a/data/0_8/high_level_api/ct_compressed_seeded_signed.bcode b/data/0_8/high_level_api/ct_compressed_seeded_signed.bcode new file mode 100644 index 0000000..90e9335 --- /dev/null +++ b/data/0_8/high_level_api/ct_compressed_seeded_signed.bcode @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cc46fa11c1c0ebb35cd93d315835f33ae3b6ef1606a37252bb95c1601b2c79ee +size 564 diff --git a/data/0_8/high_level_api/ct_compressed_seeded_signed.cbor b/data/0_8/high_level_api/ct_compressed_seeded_signed.cbor new file mode 100644 index 0000000..930e9b0 --- /dev/null +++ b/data/0_8/high_level_api/ct_compressed_seeded_signed.cbor @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:293e0207346f13bce6ce51b83b98351debdf8774d6e5958a82460d22bed62d4c +size 1009 diff --git a/data/0_8/high_level_api/hl_compressed_heterogeneous_list.bcode b/data/0_8/high_level_api/hl_compressed_heterogeneous_list.bcode new file mode 100644 index 0000000..ce66d6f --- /dev/null +++ b/data/0_8/high_level_api/hl_compressed_heterogeneous_list.bcode @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e94dd2396b283fc379456cdfcce55cbda7e117ca1b0ebe22241489394c14c5b7 +size 1824 diff --git a/data/0_8/high_level_api/hl_compressed_heterogeneous_list.cbor b/data/0_8/high_level_api/hl_compressed_heterogeneous_list.cbor new file mode 100644 index 0000000..ed73449 --- /dev/null +++ b/data/0_8/high_level_api/hl_compressed_heterogeneous_list.cbor @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:075182f7f707dae42748e8685fd673edbc041658d2b9ab197c61476256ba7be6 +size 2240 diff --git a/data/0_8/high_level_api/hl_heterogeneous_list.bcode b/data/0_8/high_level_api/hl_heterogeneous_list.bcode new file mode 100644 index 0000000..3a6d07c --- /dev/null +++ b/data/0_8/high_level_api/hl_heterogeneous_list.bcode @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fae52ee430a33ded5abd0b0e39b85ee3043c64b25950cd8048285c972abce823 +size 16672 diff --git a/data/0_8/high_level_api/hl_heterogeneous_list.cbor b/data/0_8/high_level_api/hl_heterogeneous_list.cbor new file mode 100644 index 0000000..4964a17 --- /dev/null +++ b/data/0_8/high_level_api/hl_heterogeneous_list.cbor @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:938540698c799e6b52a29f32d350293abcd3103a2ed79255efdabd1ff3b8f0d6 +size 18857 diff --git a/data/0_8/high_level_api/hl_packed_heterogeneous_list.bcode b/data/0_8/high_level_api/hl_packed_heterogeneous_list.bcode new file mode 100644 index 0000000..4d5ed47 --- /dev/null +++ b/data/0_8/high_level_api/hl_packed_heterogeneous_list.bcode @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:63c6da03b45d45d4b17b9493c2fdf23fb24beb80330f08f04bfd829a2a29de2b +size 16632 diff --git a/data/0_8/high_level_api/hl_packed_heterogeneous_list.cbor b/data/0_8/high_level_api/hl_packed_heterogeneous_list.cbor new file mode 100644 index 0000000..10dd08a --- /dev/null +++ b/data/0_8/high_level_api/hl_packed_heterogeneous_list.cbor @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2f6f10290d8a14c6ff42ad00f26d75572c512a6ce54584e0ad23f38aa2f02cea +size 18812 diff --git a/data/0_8/high_level_api/hl_proven_heterogeneous_list.bcode b/data/0_8/high_level_api/hl_proven_heterogeneous_list.bcode index 9f5f0a2..beeb869 100644 --- a/data/0_8/high_level_api/hl_proven_heterogeneous_list.bcode +++ b/data/0_8/high_level_api/hl_proven_heterogeneous_list.bcode @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:93d837fa8d802e49fd101d15e7f213b13582861a64b716344346f7fcd0f14cb9 +oid sha256:617b7963be92d1738ed48f1cc24dda73313936436107b7544f31fb13fbb2bcc1 size 17803 diff --git a/data/0_8/high_level_api/hl_proven_heterogeneous_list.cbor b/data/0_8/high_level_api/hl_proven_heterogeneous_list.cbor index 7c61f18..21914ef 100644 --- a/data/0_8/high_level_api/hl_proven_heterogeneous_list.cbor +++ b/data/0_8/high_level_api/hl_proven_heterogeneous_list.cbor @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b6e5e4395d6923fdf7688e134ffdca30568e1b67be73a7789d91c2ac3ab1777d +oid sha256:d2b0a4d294832d2e192dc17dc25859a4fc86e90f6a02e8b8f7c7c1301182f72c size 20219 diff --git a/data/0_8/high_level_api/hl_proven_packed_heterogeneous_list.bcode b/data/0_8/high_level_api/hl_proven_packed_heterogeneous_list.bcode deleted file mode 100644 index 215547c..0000000 --- a/data/0_8/high_level_api/hl_proven_packed_heterogeneous_list.bcode +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:9f52c419fe45ff0227f697493eb245549d6623f8722a33e6006b8ac013b2f977 -size 16632 diff --git a/data/0_8/high_level_api/hl_proven_packed_heterogeneous_list.cbor b/data/0_8/high_level_api/hl_proven_packed_heterogeneous_list.cbor deleted file mode 100644 index 6eec1c3..0000000 --- a/data/0_8/high_level_api/hl_proven_packed_heterogeneous_list.cbor +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:450a792596689698633685f066d9cc9623583c05da7476908a14b97e0fcd4c8b -size 18812 diff --git a/data/0_8/high_level_api/legacy_public_key.bcode b/data/0_8/high_level_api/legacy_public_key.bcode new file mode 100644 index 0000000..9fc8a35 --- /dev/null +++ b/data/0_8/high_level_api/legacy_public_key.bcode @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:814c99341c2287831f6bae2f9023f6c94efd5eebcc0bb56161fe222b1059360f +size 73548 diff --git a/data/0_8/high_level_api/legacy_public_key.cbor b/data/0_8/high_level_api/legacy_public_key.cbor new file mode 100644 index 0000000..b89b6e9 --- /dev/null +++ b/data/0_8/high_level_api/legacy_public_key.cbor @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6819ec3fb394ae1734b59790afee68d5c1eccd2b0d39081336839d4bd87c1755 +size 83006 diff --git a/data/0_8/high_level_api/public_key.cbor b/data/0_8/high_level_api/public_key.cbor index 854d1d7..2b6bd5a 100644 --- a/data/0_8/high_level_api/public_key.cbor +++ b/data/0_8/high_level_api/public_key.cbor @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5f160f589db566a84219a2b7a5cdff3577c0ec5bebd6f4b13cb0870a585f6562 +oid sha256:22fc922125d1c4e637024e1e60aca241ce25d5711f4eb91f5a0878ad9e75f9d0 size 37281 diff --git a/data/0_8/high_level_api/server_key.bcode b/data/0_8/high_level_api/server_key.bcode new file mode 100644 index 0000000..b9f5254 --- /dev/null +++ b/data/0_8/high_level_api/server_key.bcode @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dcf12f83fbe7aed110dd9bcd8faf305927a0312a680b19dde99cdb7d8bfdac19 +size 130904055 diff --git a/data/0_8/high_level_api/server_key.cbor b/data/0_8/high_level_api/server_key.cbor new file mode 100644 index 0000000..b67ab12 --- /dev/null +++ b/data/0_8/high_level_api/server_key.cbor @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9d92313a6f7020c2cce7529a9660a5f8ad56ee7cc97f649d414a9d214173beaa +size 150879193 diff --git a/data/0_8/high_level_api/server_key_with_compression.bcode b/data/0_8/high_level_api/server_key_with_compression.bcode new file mode 100644 index 0000000..89cdc0b --- /dev/null +++ b/data/0_8/high_level_api/server_key_with_compression.bcode @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:37da58d8d27281c72d87f8b9b61c0db8d4bf01f5c447cc097f54227e666663f6 +size 281931995 diff --git a/data/0_8/high_level_api/server_key_with_compression.cbor b/data/0_8/high_level_api/server_key_with_compression.cbor new file mode 100644 index 0000000..802002a --- /dev/null +++ b/data/0_8/high_level_api/server_key_with_compression.cbor @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4b43658dc031ec17ddc9e8bfffc81f3d8f99083d19a944c4c6558547f66b1099 +size 324955532 diff --git a/data/0_6/shortint/client_key.bcode b/data/0_8/shortint/client_key.bcode similarity index 100% rename from data/0_6/shortint/client_key.bcode rename to data/0_8/shortint/client_key.bcode diff --git a/data/0_6/shortint/client_key.cbor b/data/0_8/shortint/client_key.cbor similarity index 100% rename from data/0_6/shortint/client_key.cbor rename to data/0_8/shortint/client_key.cbor diff --git a/data/0_6/shortint/ct1.bcode b/data/0_8/shortint/ct1.bcode similarity index 100% rename from data/0_6/shortint/ct1.bcode rename to data/0_8/shortint/ct1.bcode diff --git a/data/0_6/shortint/ct1.cbor b/data/0_8/shortint/ct1.cbor similarity index 100% rename from data/0_6/shortint/ct1.cbor rename to data/0_8/shortint/ct1.cbor diff --git a/data/0_6/shortint/ct2.bcode b/data/0_8/shortint/ct2.bcode similarity index 100% rename from data/0_6/shortint/ct2.bcode rename to data/0_8/shortint/ct2.bcode diff --git a/data/0_6/shortint/ct2.cbor b/data/0_8/shortint/ct2.cbor similarity index 100% rename from data/0_6/shortint/ct2.cbor rename to data/0_8/shortint/ct2.cbor diff --git a/data/0_9/high_level_api/client_key.bcode b/data/0_9/high_level_api/client_key.bcode new file mode 100644 index 0000000..ad75a29 --- /dev/null +++ b/data/0_9/high_level_api/client_key.bcode @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e431d4f131647646961ed1ab1cc880fd61f15f83348d2ae1b8f442ee7e75fc1e +size 32106 diff --git a/data/0_9/high_level_api/client_key.cbor b/data/0_9/high_level_api/client_key.cbor new file mode 100644 index 0000000..211502c --- /dev/null +++ b/data/0_9/high_level_api/client_key.cbor @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e8cb90afb13749e5c9cf5cf2756bfde435bd92f664c5e65ad9cc4bc908eb36ab +size 4950 diff --git a/data/0_9/high_level_api/compressed_server_key.bcode b/data/0_9/high_level_api/compressed_server_key.bcode new file mode 100644 index 0000000..f78ef58 --- /dev/null +++ b/data/0_9/high_level_api/compressed_server_key.bcode @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:28eef5a67971dfedd00b2173141574f859a766230aeb85fc7d7e0bbff729bc7b +size 79479387 diff --git a/data/0_9/high_level_api/compressed_server_key.cbor b/data/0_9/high_level_api/compressed_server_key.cbor new file mode 100644 index 0000000..bfe178e --- /dev/null +++ b/data/0_9/high_level_api/compressed_server_key.cbor @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e3a986bd2e8331094ae61284ae85c696ddab978994d8c5c193372c6a3a443c88 +size 89414885 diff --git a/data/high_level_api.ron b/data/high_level_api.ron index 70d43b4..3a72b13 100644 --- a/data/high_level_api.ron +++ b/data/high_level_api.ron @@ -1,20 +1,20 @@ [ ( - tfhe_version_min: "0.6", + tfhe_version_min: "0.8", tfhe_module: "high_level_api", metadata: HlClientKey(( - test_filename: "client_key", + test_filename: "batch_1_client_key", parameters: ( - lwe_dimension: 761, + lwe_dimension: 887, glwe_dimension: 1, polynomial_size: 2048, - lwe_noise_distribution: Gaussian( - stddev: 0.00000636835566258815, + lwe_noise_distribution: TUniform( + bound_log2: 46, ), - glwe_noise_distribution: Gaussian( - stddev: 0.00000000000000031529322391500584, + glwe_noise_distribution: TUniform( + bound_log2: 17, ), - pbs_base_log: 23, + pbs_base_log: 22, pbs_level: 1, ks_base_log: 3, ks_level: 5, @@ -22,278 +22,231 @@ ciphertext_modulus: 18446744073709551616, carry_modulus: 4, max_noise_level: 5, - log2_p_fail: -40.05, + log2_p_fail: -64.138, encryption_key_choice: "big", ), )), ), ( - tfhe_version_min: "0.6", + tfhe_version_min: "0.8", tfhe_module: "high_level_api", metadata: HlServerKey(( test_filename: "server_key", - client_key_filename: "client_key.cbor", + client_key_filename: "batch_1_client_key", compressed: false, )), ), ( - tfhe_version_min: "0.6", + tfhe_version_min: "0.8", tfhe_module: "high_level_api", metadata: HlPublicKey(( - test_filename: "public_key", - client_key_filename: "client_key_for_pubkey.cbor", + test_filename: "legacy_public_key", + client_key_filename: "client_key_for_pubkey", compressed: false, compact: false, )), ), ( - tfhe_version_min: "0.6", + tfhe_version_min: "0.8", tfhe_module: "high_level_api", metadata: HlPublicKey(( - test_filename: "compressed_public_key", - client_key_filename: "client_key.cbor", + test_filename: "compressed_legacy_public_key", + client_key_filename: "batch_1_client_key", compressed: true, compact: false, )), ), ( - tfhe_version_min: "0.6", + tfhe_version_min: "0.8", tfhe_module: "high_level_api", metadata: HlPublicKey(( test_filename: "compact_public_key", - client_key_filename: "client_key.cbor", + client_key_filename: "batch_1_client_key", compressed: false, compact: true, )), ), ( - tfhe_version_min: "0.6", + tfhe_version_min: "0.8", tfhe_module: "high_level_api", metadata: HlPublicKey(( test_filename: "compressed_compact_public_key", - client_key_filename: "client_key.cbor", + client_key_filename: "batch_1_client_key", compressed: true, compact: true, )), ), ( - tfhe_version_min: "0.6", - tfhe_module: "high_level_api", - metadata: HlServerKey(( - test_filename: "compressed_server_key", - client_key_filename: "client_key.cbor", - compressed: true, - )), - ), - ( - tfhe_version_min: "0.6", + tfhe_version_min: "0.8", tfhe_module: "high_level_api", metadata: HlCiphertext(( test_filename: "ct1", - key_filename: "client_key.cbor", + key_filename: "batch_1_client_key", compressed: false, compact: false, clear_value: 0, )), ), ( - tfhe_version_min: "0.6", + tfhe_version_min: "0.8", tfhe_module: "high_level_api", metadata: HlCiphertext(( test_filename: "ct2", - key_filename: "client_key.cbor", + key_filename: "batch_1_client_key", compressed: false, compact: false, clear_value: 255, )), ), ( - tfhe_version_min: "0.6", + tfhe_version_min: "0.8", tfhe_module: "high_level_api", metadata: HlCiphertext(( test_filename: "ct_compressed_seeded", - key_filename: "client_key.cbor", + key_filename: "batch_1_client_key", compressed: true, compact: false, clear_value: 255, )), ), ( - tfhe_version_min: "0.6", + tfhe_version_min: "0.8", tfhe_module: "high_level_api", metadata: HlCiphertext(( test_filename: "ct_compressed_modswitched", - key_filename: "client_key.cbor", + key_filename: "batch_1_client_key", compressed: true, compact: false, clear_value: 255, )), ), ( - tfhe_version_min: "0.6", - tfhe_module: "high_level_api", - metadata: HlCiphertext(( - test_filename: "ct_compact", - key_filename: "client_key.cbor", - compressed: false, - compact: true, - clear_value: 255, - )), - ), - ( - tfhe_version_min: "0.6", - tfhe_module: "high_level_api", - metadata: HlCiphertextList(( - test_filename: "ct_list", - key_filename: "client_key.cbor", - clear_values: [ - 0, - 255, - ], - )), - ), - ( - tfhe_version_min: "0.6", + tfhe_version_min: "0.8", tfhe_module: "high_level_api", metadata: HlSignedCiphertext(( test_filename: "ct1_signed", - key_filename: "client_key.cbor", + key_filename: "batch_1_client_key", compressed: false, compact: false, clear_value: 0, )), ), ( - tfhe_version_min: "0.6", + tfhe_version_min: "0.8", tfhe_module: "high_level_api", metadata: HlSignedCiphertext(( test_filename: "ct2_signed", - key_filename: "client_key.cbor", + key_filename: "batch_1_client_key", compressed: false, compact: false, clear_value: -127, )), ), ( - tfhe_version_min: "0.6", + tfhe_version_min: "0.8", tfhe_module: "high_level_api", metadata: HlSignedCiphertext(( test_filename: "ct_compressed_seeded_signed", - key_filename: "client_key.cbor", + key_filename: "batch_1_client_key", compressed: true, compact: false, clear_value: 255, )), ), ( - tfhe_version_min: "0.6", + tfhe_version_min: "0.8", tfhe_module: "high_level_api", metadata: HlSignedCiphertext(( test_filename: "ct_compressed_modswitched_signed", - key_filename: "client_key.cbor", + key_filename: "batch_1_client_key", compressed: true, compact: false, clear_value: 255, )), ), ( - tfhe_version_min: "0.6", - tfhe_module: "high_level_api", - metadata: HlSignedCiphertext(( - test_filename: "ct_compact_signed", - key_filename: "client_key.cbor", - compressed: false, - compact: true, - clear_value: 255, - )), - ), - ( - tfhe_version_min: "0.6", - tfhe_module: "high_level_api", - metadata: HlSignedCiphertextList(( - test_filename: "ct_list_signed", - key_filename: "client_key.cbor", - clear_values: [ - -127, - 0, - 127, - ], - )), - ), - ( - tfhe_version_min: "0.6", + tfhe_version_min: "0.8", tfhe_module: "high_level_api", metadata: HlBoolCiphertext(( test_filename: "bool1", - key_filename: "client_key.cbor", + key_filename: "batch_1_client_key", compressed: false, compact: false, clear_value: true, )), ), ( - tfhe_version_min: "0.6", + tfhe_version_min: "0.8", tfhe_module: "high_level_api", metadata: HlBoolCiphertext(( test_filename: "bool2", - key_filename: "client_key.cbor", + key_filename: "batch_1_client_key", compressed: false, compact: false, clear_value: false, )), ), ( - tfhe_version_min: "0.6", + tfhe_version_min: "0.8", tfhe_module: "high_level_api", metadata: HlBoolCiphertext(( test_filename: "compressed_seeded_bool", - key_filename: "client_key.cbor", + key_filename: "batch_1_client_key", compressed: true, compact: false, clear_value: true, )), ), ( - tfhe_version_min: "0.6", + tfhe_version_min: "0.8", tfhe_module: "high_level_api", metadata: HlBoolCiphertext(( test_filename: "compressed_modswitched_bool", - key_filename: "client_key.cbor", + key_filename: "batch_1_client_key", compressed: true, compact: false, clear_value: true, )), ), ( - tfhe_version_min: "0.6", + tfhe_version_min: "0.8", tfhe_module: "high_level_api", metadata: HlBoolCiphertext(( test_filename: "compact_bool", - key_filename: "client_key.cbor", + key_filename: "batch_1_client_key", compressed: false, compact: true, clear_value: true, )), ), ( - tfhe_version_min: "0.6", + tfhe_version_min: "0.8", tfhe_module: "high_level_api", - metadata: HlBoolCiphertextList(( - test_filename: "bool_list", - key_filename: "client_key.cbor", + metadata: HlHeterogeneousCiphertextList(( + test_filename: "hl_heterogeneous_list", + key_filename: "batch_2_client_key", + compressed: false, + proof_info: None, clear_values: [ - true, - false, - true, + 17, + 18446744073709551604, + 0, + 1, + ], + data_kinds: [ + Unsigned, + Signed, + Bool, + Bool, ], )), ), ( - tfhe_version_min: "0.7", + tfhe_version_min: "0.8", tfhe_module: "high_level_api", metadata: HlHeterogeneousCiphertextList(( test_filename: "hl_packed_heterogeneous_list", - key_filename: "client_key.cbor", + key_filename: "batch_2_client_key", compressed: false, proof_info: None, clear_values: [ @@ -311,12 +264,12 @@ )), ), ( - tfhe_version_min: "0.7", + tfhe_version_min: "0.8", tfhe_module: "high_level_api", metadata: HlHeterogeneousCiphertextList(( - test_filename: "hl_heterogeneous_list", - key_filename: "client_key.cbor", - compressed: false, + test_filename: "hl_compressed_heterogeneous_list", + key_filename: "batch_2_client_key", + compressed: true, proof_info: None, clear_values: [ 17, @@ -333,13 +286,17 @@ )), ), ( - tfhe_version_min: "0.7", + tfhe_version_min: "0.8", tfhe_module: "high_level_api", metadata: HlHeterogeneousCiphertextList(( - test_filename: "hl_compressed_heterogeneous_list", - key_filename: "client_key.cbor", - compressed: true, - proof_info: None, + test_filename: "hl_proven_heterogeneous_list", + key_filename: "batch_2_client_key", + compressed: false, + proof_info: Some(( + public_key_filename: "public_key", + params_filename: "zk_pke_public_params", + metadata: "drawkcab", + )), clear_values: [ 17, 18446744073709551604, @@ -355,21 +312,34 @@ )), ), ( - tfhe_version_min: "0.7", + tfhe_version_min: "0.8", + tfhe_module: "high_level_api", + metadata: ZkPkePublicParams(( + test_filename: "zk_pke_public_params", + lwe_dimension: 2048, + max_num_cleartext: 16, + noise_bound: 46, + ciphertext_modulus: 18446744073709551616, + plaintext_modulus: 32, + padding_bit_count: 1, + )), + ), + ( + tfhe_version_min: "0.8", tfhe_module: "high_level_api", metadata: HlClientKey(( test_filename: "client_key_with_compression", parameters: ( - lwe_dimension: 761, + lwe_dimension: 887, glwe_dimension: 1, polynomial_size: 2048, - lwe_noise_distribution: Gaussian( - stddev: 0.00000636835566258815, + lwe_noise_distribution: TUniform( + bound_log2: 46, ), - glwe_noise_distribution: Gaussian( - stddev: 0.00000000000000031529322391500584, + glwe_noise_distribution: TUniform( + bound_log2: 17, ), - pbs_base_log: 23, + pbs_base_log: 22, pbs_level: 1, ks_base_log: 3, ks_level: 5, @@ -377,57 +347,55 @@ ciphertext_modulus: 18446744073709551616, carry_modulus: 4, max_noise_level: 5, - log2_p_fail: -40.05, + log2_p_fail: -64.138, encryption_key_choice: "big", ), )), ), ( - tfhe_version_min: "0.7", + tfhe_version_min: "0.8", tfhe_module: "high_level_api", metadata: HlServerKey(( test_filename: "server_key_with_compression", - client_key_filename: "client_key_with_compression.cbor", + client_key_filename: "client_key_with_compression", compressed: false, )), ), ( - tfhe_version_min: "0.8", + tfhe_version_min: "0.9", tfhe_module: "high_level_api", - metadata: ZkPkePublicParams(( - test_filename: "zk_pke_public_params", - lwe_dimension: 2048, - max_num_cleartext: 16, - noise_bound: 46, - ciphertext_modulus: 18446744073709551616, - plaintext_modulus: 32, - padding_bit_count: 1, + metadata: HlClientKey(( + test_filename: "client_key", + parameters: ( + lwe_dimension: 887, + glwe_dimension: 1, + polynomial_size: 2048, + lwe_noise_distribution: TUniform( + bound_log2: 46, + ), + glwe_noise_distribution: TUniform( + bound_log2: 17, + ), + pbs_base_log: 22, + pbs_level: 1, + ks_base_log: 3, + ks_level: 5, + message_modulus: 4, + ciphertext_modulus: 18446744073709551616, + carry_modulus: 4, + max_noise_level: 5, + log2_p_fail: -64.138, + encryption_key_choice: "big", + ), )), ), ( - tfhe_version_min: "0.8", + tfhe_version_min: "0.9", tfhe_module: "high_level_api", - metadata: HlHeterogeneousCiphertextList(( - test_filename: "hl_proven_heterogeneous_list", - key_filename: "client_key.cbor", - compressed: false, - proof_info: Some(( - public_key_filename: "public_key.cbor", - params_filename: "zk_pke_public_params.cbor", - metadata: "drawkcab", - )), - clear_values: [ - 17, - 18446744073709551604, - 0, - 1, - ], - data_kinds: [ - Unsigned, - Signed, - Bool, - Bool, - ], + metadata: HlServerKey(( + test_filename: "compressed_server_key", + client_key_filename: "client_key.cbor", + compressed: true, )), ), ] \ No newline at end of file diff --git a/data/shortint.ron b/data/shortint.ron index a069784..0573cb5 100644 --- a/data/shortint.ron +++ b/data/shortint.ron @@ -1,6 +1,6 @@ [ ( - tfhe_version_min: "0.6", + tfhe_version_min: "0.8", tfhe_module: "shortint", metadata: ShortintClientKey(( test_filename: "client_key", @@ -28,20 +28,20 @@ )), ), ( - tfhe_version_min: "0.6", + tfhe_version_min: "0.8", tfhe_module: "shortint", metadata: ShortintCiphertext(( test_filename: "ct1", - key_filename: "client_key.cbor", + key_filename: "client_key", clear_value: 0, )), ), ( - tfhe_version_min: "0.6", + tfhe_version_min: "0.8", tfhe_module: "shortint", metadata: ShortintCiphertext(( test_filename: "ct2", - key_filename: "client_key.cbor", + key_filename: "client_key", clear_value: 3, )), ), diff --git a/src/data_0_6.rs b/src/data_0_6.rs deleted file mode 100644 index 01be116..0000000 --- a/src/data_0_6.rs +++ /dev/null @@ -1,512 +0,0 @@ -use crate::generate::{save_cbor, store_versioned_test_01, TfhersVersion, VALID_TEST_PARAMS}; -use crate::{ - HlBoolCiphertextListTest, HlBoolCiphertextTest, HlCiphertextListTest, HlCiphertextTest, - HlClientKeyTest, HlPublicKeyTest, HlServerKeyTest, HlSignedCiphertextListTest, - HlSignedCiphertextTest, ShortintCiphertextTest, ShortintClientKeyTest, TestDistribution, - TestMetadata, TestParameterSet, HL_MODULE_NAME, SHORTINT_MODULE_NAME, -}; -use std::borrow::Cow; -use std::fs::create_dir_all; -use tfhe_0_6::boolean::engine::BooleanEngine; -use tfhe_0_6::core_crypto::commons::generators::DeterministicSeeder; -use tfhe_0_6::core_crypto::commons::math::random::{ActivatedRandomGenerator, Seed}; -use tfhe_0_6::core_crypto::prelude::TUniform; -use tfhe_0_6::prelude::FheEncrypt; -use tfhe_0_6::shortint::engine::ShortintEngine; -use tfhe_0_6::shortint::parameters::{ - DecompositionBaseLog, DecompositionLevelCount, DynamicDistribution, GlweDimension, - LweDimension, PolynomialSize, StandardDev, PARAM_MESSAGE_1_CARRY_1_PBS_KS, -}; -use tfhe_0_6::shortint::{ - self, CarryModulus, CiphertextModulus, ClassicPBSParameters, EncryptionKeyChoice, - MaxNoiseLevel, MessageModulus, PBSParameters, -}; -use tfhe_0_6::{ - generate_keys, set_server_key, ClientKey, CompactFheBool, CompactFheBoolList, CompactFheInt8, - CompactFheInt8List, CompactFheUint8, CompactFheUint8List, CompactPublicKey, - CompressedCompactPublicKey, CompressedFheBool, CompressedFheInt8, CompressedFheUint8, - CompressedPublicKey, CompressedServerKey, ConfigBuilder, FheBool, FheInt8, FheUint8, PublicKey, -}; -use tfhe_versionable_0_1::Versionize; - -macro_rules! store_versioned_test { - ($msg:expr, $dir:expr, $test_filename:expr $(,)? ) => { - store_versioned_test_01($msg, $dir, $test_filename) - }; -} - -impl From for DynamicDistribution { - fn from(value: TestDistribution) -> Self { - match value { - TestDistribution::Gaussian { stddev } => { - DynamicDistribution::new_gaussian_from_std_dev(StandardDev(stddev)) - } - TestDistribution::TUniform { bound_log2 } => { - DynamicDistribution::TUniform(TUniform::new(bound_log2)) - } - } - } -} - -impl From for ClassicPBSParameters { - fn from(value: TestParameterSet) -> Self { - ClassicPBSParameters { - lwe_dimension: LweDimension(value.lwe_dimension), - glwe_dimension: GlweDimension(value.glwe_dimension), - polynomial_size: PolynomialSize(value.polynomial_size), - lwe_noise_distribution: value.lwe_noise_distribution.into(), - glwe_noise_distribution: value.glwe_noise_distribution.into(), - pbs_base_log: DecompositionBaseLog(value.pbs_base_log), - pbs_level: DecompositionLevelCount(value.pbs_level), - ks_base_log: DecompositionBaseLog(value.ks_base_log), - ks_level: DecompositionLevelCount(value.ks_level), - message_modulus: MessageModulus(value.message_modulus), - carry_modulus: CarryModulus(value.carry_modulus), - max_noise_level: MaxNoiseLevel::new(value.max_noise_level), - log2_p_fail: value.log2_p_fail, - ciphertext_modulus: CiphertextModulus::try_new(value.ciphertext_modulus).unwrap(), - encryption_key_choice: { - match &*value.encryption_key_choice { - "big" => EncryptionKeyChoice::Big, - "small" => EncryptionKeyChoice::Small, - _ => panic!("Invalid encryption key choice"), - } - }, - } - } -} - -impl From for PBSParameters { - fn from(value: TestParameterSet) -> Self { - let classic_pbs: ClassicPBSParameters = value.into(); - classic_pbs.into() - } -} - -const SHORTINT_CLIENTKEY_TEST: ShortintClientKeyTest = ShortintClientKeyTest { - test_filename: Cow::Borrowed("client_key"), - parameters: VALID_TEST_PARAMS, -}; -const SHORTINT_CT1_TEST: ShortintCiphertextTest = ShortintCiphertextTest { - test_filename: Cow::Borrowed("ct1"), - key_filename: Cow::Borrowed("client_key.cbor"), - clear_value: 0, -}; -const SHORTINT_CT2_TEST: ShortintCiphertextTest = ShortintCiphertextTest { - test_filename: Cow::Borrowed("ct2"), - key_filename: Cow::Borrowed("client_key.cbor"), - clear_value: 3, -}; - -const HL_CLIENTKEY_TEST: HlClientKeyTest = HlClientKeyTest { - test_filename: Cow::Borrowed("client_key"), - parameters: VALID_TEST_PARAMS, -}; - -const HL_SERVERKEY_TEST: HlServerKeyTest = HlServerKeyTest { - test_filename: Cow::Borrowed("server_key"), - client_key_filename: Cow::Borrowed("client_key.cbor"), - compressed: false, -}; - -const HL_COMPRESSED_SERVERKEY_TEST: HlServerKeyTest = HlServerKeyTest { - test_filename: Cow::Borrowed("compressed_server_key"), - client_key_filename: Cow::Borrowed("client_key.cbor"), - compressed: true, -}; - -// We use a client key with specific parmeters for the pubkey since it can be very large -const HL_PUBKEY_TEST: HlPublicKeyTest = HlPublicKeyTest { - test_filename: Cow::Borrowed("public_key"), - client_key_filename: Cow::Borrowed("client_key_for_pubkey.cbor"), - compressed: false, - compact: false, -}; - -const HL_COMPRESSED_PUBKEY_TEST: HlPublicKeyTest = HlPublicKeyTest { - test_filename: Cow::Borrowed("compressed_public_key"), - client_key_filename: Cow::Borrowed("client_key.cbor"), - compressed: true, - compact: false, -}; - -const HL_COMPACT_PUBKEY_TEST: HlPublicKeyTest = HlPublicKeyTest { - test_filename: Cow::Borrowed("compact_public_key"), - client_key_filename: Cow::Borrowed("client_key.cbor"), - compressed: false, - compact: true, -}; - -const HL_COMPRESSED_COMPACT_PUBKEY_TEST: HlPublicKeyTest = HlPublicKeyTest { - test_filename: Cow::Borrowed("compressed_compact_public_key"), - client_key_filename: Cow::Borrowed("client_key.cbor"), - compressed: true, - compact: true, -}; - -const HL_CT1_TEST: HlCiphertextTest = HlCiphertextTest { - test_filename: Cow::Borrowed("ct1"), - key_filename: Cow::Borrowed("client_key.cbor"), - compressed: false, - compact: false, - clear_value: 0, -}; - -const HL_CT2_TEST: HlCiphertextTest = HlCiphertextTest { - test_filename: Cow::Borrowed("ct2"), - key_filename: Cow::Borrowed("client_key.cbor"), - compressed: false, - compact: false, - clear_value: 255, -}; - -const HL_COMPACT_CT_TEST: HlCiphertextTest = HlCiphertextTest { - test_filename: Cow::Borrowed("ct_compact"), - key_filename: Cow::Borrowed("client_key.cbor"), - compressed: false, - compact: true, - clear_value: 255, -}; - -const HL_COMPRESSED_SEEDED_CT_TEST: HlCiphertextTest = HlCiphertextTest { - test_filename: Cow::Borrowed("ct_compressed_seeded"), - key_filename: Cow::Borrowed("client_key.cbor"), - compressed: true, - compact: false, - clear_value: 255, -}; - -const HL_COMPRESSED_CT_MODSWITCHED_TEST: HlCiphertextTest = HlCiphertextTest { - test_filename: Cow::Borrowed("ct_compressed_modswitched"), - key_filename: Cow::Borrowed("client_key.cbor"), - compressed: true, - compact: false, - clear_value: 255, -}; - -const HL_CT_LIST_TEST: HlCiphertextListTest = HlCiphertextListTest { - test_filename: Cow::Borrowed("ct_list"), - key_filename: Cow::Borrowed("client_key.cbor"), - clear_values: Cow::Borrowed(&[0, 255]), -}; - -const HL_SIGNED_CT1_TEST: HlSignedCiphertextTest = HlSignedCiphertextTest { - test_filename: Cow::Borrowed("ct1_signed"), - key_filename: Cow::Borrowed("client_key.cbor"), - compressed: false, - compact: false, - clear_value: 0, -}; - -const HL_SIGNED_CT2_TEST: HlSignedCiphertextTest = HlSignedCiphertextTest { - test_filename: Cow::Borrowed("ct2_signed"), - key_filename: Cow::Borrowed("client_key.cbor"), - compressed: false, - compact: false, - clear_value: -127, -}; - -const HL_SIGNED_COMPACT_CT_TEST: HlSignedCiphertextTest = HlSignedCiphertextTest { - test_filename: Cow::Borrowed("ct_compact_signed"), - key_filename: Cow::Borrowed("client_key.cbor"), - compressed: false, - compact: true, - clear_value: 255, -}; - -const HL_SIGNED_CT_LIST_TEST: HlSignedCiphertextListTest = HlSignedCiphertextListTest { - test_filename: Cow::Borrowed("ct_list_signed"), - key_filename: Cow::Borrowed("client_key.cbor"), - clear_values: Cow::Borrowed(&[-127, 0, 127]), -}; - -const HL_SIGNED_COMPRESSED_SEEDED_CT_TEST: HlSignedCiphertextTest = HlSignedCiphertextTest { - test_filename: Cow::Borrowed("ct_compressed_seeded_signed"), - key_filename: Cow::Borrowed("client_key.cbor"), - compressed: true, - compact: false, - clear_value: 255, -}; - -const HL_SIGNED_COMPRESSED_CT_MODSWITCHED_TEST: HlSignedCiphertextTest = HlSignedCiphertextTest { - test_filename: Cow::Borrowed("ct_compressed_modswitched_signed"), - key_filename: Cow::Borrowed("client_key.cbor"), - compressed: true, - compact: false, - clear_value: 255, -}; - -const HL_BOOL1_TEST: HlBoolCiphertextTest = HlBoolCiphertextTest { - test_filename: Cow::Borrowed("bool1"), - key_filename: Cow::Borrowed("client_key.cbor"), - compressed: false, - compact: false, - clear_value: true, -}; - -const HL_BOOL2_TEST: HlBoolCiphertextTest = HlBoolCiphertextTest { - test_filename: Cow::Borrowed("bool2"), - key_filename: Cow::Borrowed("client_key.cbor"), - compressed: false, - compact: false, - clear_value: false, -}; - -const HL_COMPACT_BOOL_TEST: HlBoolCiphertextTest = HlBoolCiphertextTest { - test_filename: Cow::Borrowed("compact_bool"), - key_filename: Cow::Borrowed("client_key.cbor"), - compressed: false, - compact: true, - clear_value: true, -}; - -const HL_COMPRESSED_BOOL_SEEDED_TEST: HlBoolCiphertextTest = HlBoolCiphertextTest { - test_filename: Cow::Borrowed("compressed_seeded_bool"), - key_filename: Cow::Borrowed("client_key.cbor"), - compressed: true, - compact: false, - clear_value: true, -}; - -const HL_COMPRESSED_BOOL_MODSWITCHED_TEST: HlBoolCiphertextTest = HlBoolCiphertextTest { - test_filename: Cow::Borrowed("compressed_modswitched_bool"), - key_filename: Cow::Borrowed("client_key.cbor"), - compressed: true, - compact: false, - clear_value: true, -}; - -const HL_BOOL_LIST_TEST: HlBoolCiphertextListTest = HlBoolCiphertextListTest { - test_filename: Cow::Borrowed("bool_list"), - key_filename: Cow::Borrowed("client_key.cbor"), - clear_values: Cow::Borrowed(&[true, false, true]), -}; - -pub struct V0_6; - -impl TfhersVersion for V0_6 { - const VERSION_NUMBER: &'static str = "0.6"; - - fn seed_prng(seed: u128) { - let mut seeder = DeterministicSeeder::::new(Seed(seed)); - let shortint_engine = ShortintEngine::new_from_seeder(&mut seeder); - ShortintEngine::with_thread_local_mut(|local_engine| { - let _ = std::mem::replace(local_engine, shortint_engine); - }); - - let boolean_engine = BooleanEngine::new_from_seeder(&mut seeder); - BooleanEngine::replace_thread_local(boolean_engine); - } - - fn gen_shortint_data() -> Vec { - let dir = Self::data_dir().join(SHORTINT_MODULE_NAME); - create_dir_all(&dir).unwrap(); - - // generate a client key - let shortint_client_key = shortint::ClientKey::new(SHORTINT_CLIENTKEY_TEST.parameters); - - store_versioned_test!( - &shortint_client_key, - &dir, - &SHORTINT_CLIENTKEY_TEST.test_filename, - ); - - // generate ciphertexts - let ct1 = shortint_client_key.encrypt(SHORTINT_CT1_TEST.clear_value); - let ct2 = shortint_client_key.encrypt(SHORTINT_CT2_TEST.clear_value); - - // Serialize them - store_versioned_test!(&ct1, &dir, &SHORTINT_CT1_TEST.test_filename); - store_versioned_test!(&ct2, &dir, &SHORTINT_CT2_TEST.test_filename); - - vec![ - TestMetadata::ShortintClientKey(SHORTINT_CLIENTKEY_TEST), - TestMetadata::ShortintCiphertext(SHORTINT_CT1_TEST), - TestMetadata::ShortintCiphertext(SHORTINT_CT2_TEST), - ] - } - - fn gen_hl_data() -> Vec { - let dir = Self::data_dir().join(HL_MODULE_NAME); - create_dir_all(&dir).unwrap(); - - // generate keys - let config = - tfhe_0_6::ConfigBuilder::with_custom_parameters(HL_CLIENTKEY_TEST.parameters, None) - .build(); - let (hl_client_key, hl_server_key) = generate_keys(config); - - // Here we use specific parameters to generate a smaller public key. - // WARNING: these parameters are completely insecure - let mut params_pk = PARAM_MESSAGE_1_CARRY_1_PBS_KS; - params_pk.lwe_dimension = LweDimension(10); - let client_key_for_pk = - ClientKey::generate(ConfigBuilder::with_custom_parameters(params_pk, None).build()); - - let compressed_server_key = CompressedServerKey::new(&hl_client_key); - let pub_key = PublicKey::new(&client_key_for_pk); - let compressed_pub_key = CompressedPublicKey::new(&hl_client_key); - let compact_pub_key = CompactPublicKey::new(&hl_client_key); - let compressed_compact_pub_key = CompressedCompactPublicKey::new(&hl_client_key); - - store_versioned_test!(&hl_client_key, &dir, &HL_CLIENTKEY_TEST.test_filename); - - store_versioned_test!(&hl_server_key, &dir, &HL_SERVERKEY_TEST.test_filename); - store_versioned_test!( - &compressed_server_key, - &dir, - &HL_COMPRESSED_SERVERKEY_TEST.test_filename, - ); - store_versioned_test!(&pub_key, &dir, &HL_PUBKEY_TEST.test_filename); - save_cbor( - &client_key_for_pk.versionize(), - dir.join(&*HL_PUBKEY_TEST.client_key_filename), - ); - - store_versioned_test!( - &compressed_pub_key, - &dir, - &HL_COMPRESSED_PUBKEY_TEST.test_filename, - ); - store_versioned_test!( - &compact_pub_key, - &dir, - &HL_COMPACT_PUBKEY_TEST.test_filename, - ); - store_versioned_test!( - &compressed_compact_pub_key, - &dir, - &HL_COMPRESSED_COMPACT_PUBKEY_TEST.test_filename, - ); - - set_server_key(hl_server_key); - - // generate ciphertexts - let ct1 = FheUint8::encrypt(HL_CT1_TEST.clear_value, &hl_client_key); - let ct2 = FheUint8::encrypt(HL_CT2_TEST.clear_value, &hl_client_key); - - let ct1_signed = FheInt8::encrypt(HL_SIGNED_CT1_TEST.clear_value, &hl_client_key); - let ct2_signed = FheInt8::encrypt(HL_SIGNED_CT2_TEST.clear_value, &hl_client_key); - - let bool1 = FheBool::encrypt(HL_BOOL1_TEST.clear_value, &hl_client_key); - let bool2 = FheBool::encrypt(HL_BOOL2_TEST.clear_value, &hl_client_key); - - // Generate compressed ciphertexts - // The first one using seeded (default) method - let compressed_ct1 = - CompressedFheUint8::encrypt(HL_COMPRESSED_SEEDED_CT_TEST.clear_value, &hl_client_key); - let compressed_ct1_signed = CompressedFheInt8::encrypt( - HL_SIGNED_COMPRESSED_SEEDED_CT_TEST.clear_value, - &hl_client_key, - ); - let compressed_bool1 = - CompressedFheBool::encrypt(HL_COMPRESSED_BOOL_SEEDED_TEST.clear_value, &hl_client_key); - - // The second one using the modulus switched method - let compressed_ct2 = FheUint8::encrypt( - HL_COMPRESSED_CT_MODSWITCHED_TEST.clear_value, - &hl_client_key, - ) - .compress(); - let compressed_ct2_signed = FheInt8::encrypt( - HL_SIGNED_COMPRESSED_CT_MODSWITCHED_TEST.clear_value, - &hl_client_key, - ) - .compress(); - let compressed_bool2 = CompressedFheBool::encrypt( - HL_COMPRESSED_BOOL_MODSWITCHED_TEST.clear_value, - &hl_client_key, - ); - - // Generates a compact ct - let compact_ct = CompactFheUint8::encrypt(HL_COMPACT_CT_TEST.clear_value, &compact_pub_key); - let compact_ct_signed = - CompactFheInt8::encrypt(HL_SIGNED_COMPACT_CT_TEST.clear_value, &compact_pub_key); - let compact_bool = - CompactFheBool::encrypt(HL_COMPACT_BOOL_TEST.clear_value, &compact_pub_key); - - let ct_list = CompactFheUint8List::encrypt(&HL_CT_LIST_TEST.clear_values, &compact_pub_key); - let ct_list_signed = - CompactFheInt8List::encrypt(&HL_SIGNED_CT_LIST_TEST.clear_values, &compact_pub_key); - let bool_list = - CompactFheBoolList::encrypt(&HL_BOOL_LIST_TEST.clear_values, &compact_pub_key); - - // Serialize them - store_versioned_test!(&ct1, &dir, &HL_CT1_TEST.test_filename); - store_versioned_test!(&ct2, &dir, &HL_CT2_TEST.test_filename); - store_versioned_test!( - &compressed_ct1, - &dir, - &HL_COMPRESSED_SEEDED_CT_TEST.test_filename, - ); - store_versioned_test!( - &compressed_ct2, - &dir, - &HL_COMPRESSED_CT_MODSWITCHED_TEST.test_filename, - ); - store_versioned_test!(&compact_ct, &dir, &HL_COMPACT_CT_TEST.test_filename); - store_versioned_test!(&ct_list, &dir, &HL_CT_LIST_TEST.test_filename); - - store_versioned_test!(&ct1_signed, &dir, &HL_SIGNED_CT1_TEST.test_filename); - store_versioned_test!(&ct2_signed, &dir, &HL_SIGNED_CT2_TEST.test_filename); - store_versioned_test!( - &compressed_ct1_signed, - &dir, - &HL_SIGNED_COMPRESSED_SEEDED_CT_TEST.test_filename, - ); - store_versioned_test!( - &compressed_ct2_signed, - &dir, - &HL_SIGNED_COMPRESSED_CT_MODSWITCHED_TEST.test_filename, - ); - store_versioned_test!( - &compact_ct_signed, - &dir, - &HL_SIGNED_COMPACT_CT_TEST.test_filename, - ); - store_versioned_test!(&ct_list_signed, &dir, &HL_SIGNED_CT_LIST_TEST.test_filename); - - store_versioned_test!(&bool1, &dir, &HL_BOOL1_TEST.test_filename); - store_versioned_test!(&bool2, &dir, &HL_BOOL2_TEST.test_filename); - store_versioned_test!( - &compressed_bool1, - &dir, - &HL_COMPRESSED_BOOL_SEEDED_TEST.test_filename, - ); - store_versioned_test!( - &compressed_bool2, - &dir, - &HL_COMPRESSED_BOOL_MODSWITCHED_TEST.test_filename, - ); - store_versioned_test!(&compact_bool, &dir, &HL_COMPACT_BOOL_TEST.test_filename); - store_versioned_test!(&bool_list, &dir, &HL_BOOL_LIST_TEST.test_filename); - - vec![ - TestMetadata::HlClientKey(HL_CLIENTKEY_TEST), - TestMetadata::HlServerKey(HL_SERVERKEY_TEST), - TestMetadata::HlPublicKey(HL_PUBKEY_TEST), - TestMetadata::HlPublicKey(HL_COMPRESSED_PUBKEY_TEST), - TestMetadata::HlPublicKey(HL_COMPACT_PUBKEY_TEST), - TestMetadata::HlPublicKey(HL_COMPRESSED_COMPACT_PUBKEY_TEST), - TestMetadata::HlServerKey(HL_COMPRESSED_SERVERKEY_TEST), - TestMetadata::HlCiphertext(HL_CT1_TEST), - TestMetadata::HlCiphertext(HL_CT2_TEST), - TestMetadata::HlCiphertext(HL_COMPRESSED_SEEDED_CT_TEST), - TestMetadata::HlCiphertext(HL_COMPRESSED_CT_MODSWITCHED_TEST), - TestMetadata::HlCiphertext(HL_COMPACT_CT_TEST), - TestMetadata::HlCiphertextList(HL_CT_LIST_TEST), - TestMetadata::HlSignedCiphertext(HL_SIGNED_CT1_TEST), - TestMetadata::HlSignedCiphertext(HL_SIGNED_CT2_TEST), - TestMetadata::HlSignedCiphertext(HL_SIGNED_COMPRESSED_SEEDED_CT_TEST), - TestMetadata::HlSignedCiphertext(HL_SIGNED_COMPRESSED_CT_MODSWITCHED_TEST), - TestMetadata::HlSignedCiphertext(HL_SIGNED_COMPACT_CT_TEST), - TestMetadata::HlSignedCiphertextList(HL_SIGNED_CT_LIST_TEST), - TestMetadata::HlBoolCiphertext(HL_BOOL1_TEST), - TestMetadata::HlBoolCiphertext(HL_BOOL2_TEST), - TestMetadata::HlBoolCiphertext(HL_COMPRESSED_BOOL_SEEDED_TEST), - TestMetadata::HlBoolCiphertext(HL_COMPRESSED_BOOL_MODSWITCHED_TEST), - TestMetadata::HlBoolCiphertext(HL_COMPACT_BOOL_TEST), - TestMetadata::HlBoolCiphertextList(HL_BOOL_LIST_TEST), - ] - } -} diff --git a/src/data_0_7.rs b/src/data_0_7.rs deleted file mode 100644 index 57785c4..0000000 --- a/src/data_0_7.rs +++ /dev/null @@ -1,239 +0,0 @@ -use crate::generate::{ - store_versioned_auxiliary_02, store_versioned_test_02, TfhersVersion, VALID_TEST_PARAMS, -}; -use crate::{ - DataKind, HlClientKeyTest, HlHeterogeneousCiphertextListTest, HlServerKeyTest, - TestDistribution, TestMetadata, TestParameterSet, HL_MODULE_NAME, -}; -use std::borrow::Cow; -use std::fs::create_dir_all; -use tfhe_0_7::boolean::engine::BooleanEngine; -use tfhe_0_7::core_crypto::commons::generators::DeterministicSeeder; -use tfhe_0_7::core_crypto::commons::math::random::ActivatedRandomGenerator; -use tfhe_0_7::core_crypto::prelude::TUniform; -use tfhe_0_7::prelude::FheEncrypt; -use tfhe_0_7::shortint::engine::ShortintEngine; -use tfhe_0_7::shortint::parameters::{ - DecompositionBaseLog, DecompositionLevelCount, DynamicDistribution, GlweDimension, - LweDimension, PolynomialSize, StandardDev, COMP_PARAM_MESSAGE_2_CARRY_2, -}; -use tfhe_0_7::shortint::{ - CarryModulus, CiphertextModulus, ClassicPBSParameters, EncryptionKeyChoice, MaxNoiseLevel, - MessageModulus, PBSParameters, -}; -use tfhe_0_7::{ - generate_keys, set_server_key, CompactCiphertextList, CompactPublicKey, - CompressedCiphertextListBuilder, FheBool, FheInt8, FheUint8, Seed, -}; - -macro_rules! store_versioned_test { - ($msg:expr, $dir:expr, $test_filename:expr $(,)? ) => { - store_versioned_test_02($msg, $dir, $test_filename) - }; -} - -macro_rules! store_versioned_auxiliary { - ($msg:expr, $dir:expr, $test_filename:expr $(,)? ) => { - store_versioned_auxiliary_02($msg, $dir, $test_filename) - }; -} - -impl From for DynamicDistribution { - fn from(value: TestDistribution) -> Self { - match value { - TestDistribution::Gaussian { stddev } => { - DynamicDistribution::new_gaussian_from_std_dev(StandardDev(stddev)) - } - TestDistribution::TUniform { bound_log2 } => { - DynamicDistribution::TUniform(TUniform::new(bound_log2)) - } - } - } -} - -impl From for ClassicPBSParameters { - fn from(value: TestParameterSet) -> Self { - ClassicPBSParameters { - lwe_dimension: LweDimension(value.lwe_dimension), - glwe_dimension: GlweDimension(value.glwe_dimension), - polynomial_size: PolynomialSize(value.polynomial_size), - lwe_noise_distribution: value.lwe_noise_distribution.into(), - glwe_noise_distribution: value.glwe_noise_distribution.into(), - pbs_base_log: DecompositionBaseLog(value.pbs_base_log), - pbs_level: DecompositionLevelCount(value.pbs_level), - ks_base_log: DecompositionBaseLog(value.ks_base_log), - ks_level: DecompositionLevelCount(value.ks_level), - message_modulus: MessageModulus(value.message_modulus), - carry_modulus: CarryModulus(value.carry_modulus), - max_noise_level: MaxNoiseLevel::new(value.max_noise_level), - log2_p_fail: value.log2_p_fail, - ciphertext_modulus: CiphertextModulus::try_new(value.ciphertext_modulus).unwrap(), - encryption_key_choice: { - match &*value.encryption_key_choice { - "big" => EncryptionKeyChoice::Big, - "small" => EncryptionKeyChoice::Small, - _ => panic!("Invalid encryption key choice"), - } - }, - } - } -} - -impl From for PBSParameters { - fn from(value: TestParameterSet) -> Self { - let classic_pbs: ClassicPBSParameters = value.into(); - classic_pbs.into() - } -} - -const HL_COMPACTLIST_TEST: HlHeterogeneousCiphertextListTest = HlHeterogeneousCiphertextListTest { - test_filename: Cow::Borrowed("hl_heterogeneous_list"), - key_filename: Cow::Borrowed("client_key.cbor"), - clear_values: Cow::Borrowed(&[17u8 as u64, -12i8 as u64, false as u64, true as u64]), - data_kinds: Cow::Borrowed(&[ - DataKind::Unsigned, - DataKind::Signed, - DataKind::Bool, - DataKind::Bool, - ]), - compressed: false, - proof_info: None, -}; - -const HL_PACKED_COMPACTLIST_TEST: HlHeterogeneousCiphertextListTest = - HlHeterogeneousCiphertextListTest { - test_filename: Cow::Borrowed("hl_packed_heterogeneous_list"), - key_filename: Cow::Borrowed("client_key.cbor"), - clear_values: HL_COMPACTLIST_TEST.clear_values, - data_kinds: HL_COMPACTLIST_TEST.data_kinds, - compressed: false, - proof_info: None, - }; - -const HL_COMPRESSED_LIST_TEST: HlHeterogeneousCiphertextListTest = - HlHeterogeneousCiphertextListTest { - test_filename: Cow::Borrowed("hl_compressed_heterogeneous_list"), - key_filename: Cow::Borrowed("client_key.cbor"), - clear_values: Cow::Borrowed(&[17u8 as u64, -12i8 as u64, false as u64, true as u64]), - data_kinds: Cow::Borrowed(&[ - DataKind::Unsigned, - DataKind::Signed, - DataKind::Bool, - DataKind::Bool, - ]), - compressed: true, - proof_info: None, - }; - -const HL_CLIENTKEY_WITH_COMPRESSION_TEST: HlClientKeyTest = HlClientKeyTest { - test_filename: Cow::Borrowed("client_key_with_compression"), - parameters: VALID_TEST_PARAMS, -}; - -const HL_SERVERKEY_WITH_COMPRESSION_TEST: HlServerKeyTest = HlServerKeyTest { - test_filename: Cow::Borrowed("server_key_with_compression"), - client_key_filename: Cow::Borrowed("client_key_with_compression.cbor"), - compressed: false, -}; - -pub struct V0_7; - -impl TfhersVersion for V0_7 { - const VERSION_NUMBER: &'static str = "0.7"; - - fn seed_prng(seed: u128) { - let mut seeder = DeterministicSeeder::::new(Seed(seed)); - let shortint_engine = ShortintEngine::new_from_seeder(&mut seeder); - ShortintEngine::with_thread_local_mut(|local_engine| { - let _ = std::mem::replace(local_engine, shortint_engine); - }); - - let boolean_engine = BooleanEngine::new_from_seeder(&mut seeder); - BooleanEngine::replace_thread_local(boolean_engine); - } - - fn gen_shortint_data() -> Vec { - Vec::new() - } - - fn gen_hl_data() -> Vec { - let dir = Self::data_dir().join(HL_MODULE_NAME); - create_dir_all(&dir).unwrap(); - - // Generate a compact public key needed to create a compact list - let config = tfhe_0_7::ConfigBuilder::with_custom_parameters(VALID_TEST_PARAMS, None) - .enable_compression(COMP_PARAM_MESSAGE_2_CARRY_2) - .build(); - let (hl_client_key, hl_server_key) = generate_keys(config); - - set_server_key(hl_server_key.clone()); - - let compact_pub_key = CompactPublicKey::new(&hl_client_key); - - // Store the associated client key to be able to decrypt the ciphertexts in the list - store_versioned_auxiliary!(&hl_client_key, &dir, &HL_COMPACTLIST_TEST.key_filename); - - // Generate heterogeneous list data - let mut compact_builder = CompactCiphertextList::builder(&compact_pub_key); - compact_builder - .push(HL_COMPACTLIST_TEST.clear_values[0] as u8) - .push(HL_COMPACTLIST_TEST.clear_values[1] as i8) - .push(HL_COMPACTLIST_TEST.clear_values[2] != 0) - .push(HL_COMPACTLIST_TEST.clear_values[3] != 0); - - let compact_list_packed = compact_builder.build_packed(); - let compact_list = compact_builder.build(); - - let mut compressed_builder = CompressedCiphertextListBuilder::new(); - compressed_builder - .push(FheUint8::encrypt( - HL_COMPRESSED_LIST_TEST.clear_values[0] as u8, - &hl_client_key, - )) - .push(FheInt8::encrypt( - HL_COMPRESSED_LIST_TEST.clear_values[1] as i8, - &hl_client_key, - )) - .push(FheBool::encrypt( - HL_COMPRESSED_LIST_TEST.clear_values[2] != 0, - &hl_client_key, - )) - .push(FheBool::encrypt( - HL_COMPRESSED_LIST_TEST.clear_values[3] != 0, - &hl_client_key, - )); - let compressed_list = compressed_builder.build().unwrap(); - - store_versioned_test!( - &compact_list_packed, - &dir, - &HL_PACKED_COMPACTLIST_TEST.test_filename, - ); - store_versioned_test!(&compact_list, &dir, &HL_COMPACTLIST_TEST.test_filename); - store_versioned_test!( - &compressed_list, - &dir, - &HL_COMPRESSED_LIST_TEST.test_filename, - ); - - store_versioned_test!( - &hl_client_key, - &dir, - &HL_CLIENTKEY_WITH_COMPRESSION_TEST.test_filename, - ); - - store_versioned_test!( - &hl_server_key, - &dir, - &HL_SERVERKEY_WITH_COMPRESSION_TEST.test_filename, - ); - - vec![ - TestMetadata::HlHeterogeneousCiphertextList(HL_PACKED_COMPACTLIST_TEST), - TestMetadata::HlHeterogeneousCiphertextList(HL_COMPACTLIST_TEST), - TestMetadata::HlHeterogeneousCiphertextList(HL_COMPRESSED_LIST_TEST), - TestMetadata::HlClientKey(HL_CLIENTKEY_WITH_COMPRESSION_TEST), - TestMetadata::HlServerKey(HL_SERVERKEY_WITH_COMPRESSION_TEST), - ] - } -} diff --git a/src/data_0_8.rs b/src/data_0_8.rs index e60db88..636cc5c 100644 --- a/src/data_0_8.rs +++ b/src/data_0_8.rs @@ -4,38 +4,49 @@ use tfhe_0_8::{ boolean::engine::BooleanEngine, core_crypto::{ commons::{generators::DeterministicSeeder, math::random::RandomGenerator}, - prelude::{ActivatedRandomGenerator, TUniform}, + prelude::{ActivatedRandomGenerator, CiphertextModulusLog, LweCiphertextCount, TUniform}, }, + generate_keys, integer::parameters::{ DecompositionBaseLog, DecompositionLevelCount, DynamicDistribution, GlweDimension, LweDimension, PolynomialSize, StandardDev, }, + prelude::*, + set_server_key, shortint, shortint::{ - engine::ShortintEngine, CarryModulus, CiphertextModulus, ClassicPBSParameters, - EncryptionKeyChoice, MaxNoiseLevel, MessageModulus, PBSParameters, + engine::ShortintEngine, parameters::list_compression::CompressionParameters, CarryModulus, + CiphertextModulus, ClassicPBSParameters, EncryptionKeyChoice, MaxNoiseLevel, + MessageModulus, PBSParameters, }, zk::{CompactPkeCrs, ZkComputeLoad, ZkMSBZeroPaddingBitCount}, - ClientKey, CompactPublicKey, ProvenCompactCiphertextList, Seed, + ClientKey, CompactCiphertextList, CompactPublicKey, CompressedCiphertextListBuilder, + CompressedCompactPublicKey, CompressedFheBool, CompressedFheInt8, CompressedFheUint8, + CompressedPublicKey, ConfigBuilder, FheBool, FheInt8, FheUint8, ProvenCompactCiphertextList, + PublicKey, Seed, ServerKey, }; use crate::{ generate::{ - store_versioned_auxiliary_03, store_versioned_test_03, TfhersVersion, PRNG_SEED, - VALID_TEST_PARAMS_TUNIFORM, + store_versioned_auxiliary_tfhe_08, store_versioned_test_tfhe_08, TfhersVersion, + INSECURE_SMALL_PK_TEST_PARAMS, PRNG_SEED, VALID_TEST_PARAMS, VALID_TEST_PARAMS_TUNIFORM, + VALID_TEST_PARAMS_TUNIFORM_COMPRESSION, }, - DataKind, HlHeterogeneousCiphertextListTest, PkeZkProofAuxilliaryInfo, TestDistribution, - TestMetadata, TestParameterSet, ZkPkePublicParamsTest, HL_MODULE_NAME, + DataKind, HlBoolCiphertextTest, HlCiphertextTest, HlClientKeyTest, + HlHeterogeneousCiphertextListTest, HlPublicKeyTest, HlServerKeyTest, HlSignedCiphertextTest, + PkeZkProofAuxilliaryInfo, ShortintCiphertextTest, ShortintClientKeyTest, + TestCompressionParameterSet, TestDistribution, TestMetadata, TestParameterSet, + ZkPkePublicParamsTest, HL_MODULE_NAME, SHORTINT_MODULE_NAME, }; macro_rules! store_versioned_test { ($msg:expr, $dir:expr, $test_filename:expr $(,)? ) => { - store_versioned_test_03($msg, $dir, $test_filename) + store_versioned_test_tfhe_08($msg, $dir, $test_filename) }; } macro_rules! store_versioned_auxiliary { ($msg:expr, $dir:expr, $test_filename:expr $(,)? ) => { - store_versioned_auxiliary_03($msg, $dir, $test_filename) + store_versioned_auxiliary_tfhe_08($msg, $dir, $test_filename) }; } @@ -87,26 +98,246 @@ impl From for PBSParameters { } } -const ZK_PKE_PUBLIC_PARAMS_TEST: ZkPkePublicParamsTest = ZkPkePublicParamsTest { - test_filename: Cow::Borrowed("zk_pke_public_params"), - lwe_dimension: VALID_TEST_PARAMS_TUNIFORM.polynomial_size - * VALID_TEST_PARAMS_TUNIFORM.glwe_dimension, // Lwe dimension of the "big" key is glwe dimension * polynomial size - max_num_cleartext: 16, - noise_bound: match VALID_TEST_PARAMS_TUNIFORM.lwe_noise_distribution { - TestDistribution::Gaussian { .. } => unreachable!(), - TestDistribution::TUniform { bound_log2 } => bound_log2 as usize, - }, - ciphertext_modulus: VALID_TEST_PARAMS_TUNIFORM.ciphertext_modulus, - plaintext_modulus: VALID_TEST_PARAMS_TUNIFORM.message_modulus - * VALID_TEST_PARAMS_TUNIFORM.carry_modulus - * 2, // *2 for padding bit - padding_bit_count: 1, +impl From for CompressionParameters { + fn from(value: TestCompressionParameterSet) -> Self { + let TestCompressionParameterSet { + br_level, + br_base_log, + packing_ks_level, + packing_ks_base_log, + packing_ks_polynomial_size, + packing_ks_glwe_dimension, + lwe_per_glwe, + storage_log_modulus, + packing_ks_key_noise_distribution, + } = value; + Self { + br_level: DecompositionLevelCount(br_level), + br_base_log: DecompositionBaseLog(br_base_log), + packing_ks_level: DecompositionLevelCount(packing_ks_level), + packing_ks_base_log: DecompositionBaseLog(packing_ks_base_log), + packing_ks_polynomial_size: PolynomialSize(packing_ks_polynomial_size), + packing_ks_glwe_dimension: GlweDimension(packing_ks_glwe_dimension), + lwe_per_glwe: LweCiphertextCount(lwe_per_glwe), + storage_log_modulus: CiphertextModulusLog(storage_log_modulus), + packing_ks_key_noise_distribution: packing_ks_key_noise_distribution.into(), + } + } +} + +// Shortint test constants +const SHORTINT_CLIENT_KEY_FILENAME: &str = "client_key"; + +const SHORTINT_CLIENTKEY_TEST: ShortintClientKeyTest = ShortintClientKeyTest { + test_filename: Cow::Borrowed(SHORTINT_CLIENT_KEY_FILENAME), + // Here we use the non TUniform params for shortint to be able to check gaussian params + parameters: VALID_TEST_PARAMS, +}; +const SHORTINT_CT1_TEST: ShortintCiphertextTest = ShortintCiphertextTest { + test_filename: Cow::Borrowed("ct1"), + key_filename: Cow::Borrowed(SHORTINT_CLIENT_KEY_FILENAME), + clear_value: 0, +}; +const SHORTINT_CT2_TEST: ShortintCiphertextTest = ShortintCiphertextTest { + test_filename: Cow::Borrowed("ct2"), + key_filename: Cow::Borrowed(SHORTINT_CLIENT_KEY_FILENAME), + clear_value: 3, +}; + +// HL test constants +// Batch 1 +const HL_CLIENT_KEY_BATCH_1_FILENAME: &str = "batch_1_client_key"; + +const HL_CLIENTKEY_TEST: HlClientKeyTest = HlClientKeyTest { + test_filename: Cow::Borrowed(HL_CLIENT_KEY_BATCH_1_FILENAME), + parameters: VALID_TEST_PARAMS_TUNIFORM, +}; + +const HL_SERVERKEY_TEST: HlServerKeyTest = HlServerKeyTest { + test_filename: Cow::Borrowed("server_key"), + client_key_filename: Cow::Borrowed(HL_CLIENT_KEY_BATCH_1_FILENAME), + compressed: false, +}; + +// We use a client key with specific parmeters for the pubkey since it can be very large +const HL_LEGACY_PUBKEY_TEST: HlPublicKeyTest = HlPublicKeyTest { + test_filename: Cow::Borrowed("legacy_public_key"), + client_key_filename: Cow::Borrowed("client_key_for_pubkey"), + compressed: false, + compact: false, +}; + +const HL_COMPRESSED_LEGACY_PUBKEY_TEST: HlPublicKeyTest = HlPublicKeyTest { + test_filename: Cow::Borrowed("compressed_legacy_public_key"), + client_key_filename: Cow::Borrowed(HL_CLIENT_KEY_BATCH_1_FILENAME), + compressed: true, + compact: false, +}; + +const HL_COMPACT_PUBKEY_TEST: HlPublicKeyTest = HlPublicKeyTest { + test_filename: Cow::Borrowed("compact_public_key"), + client_key_filename: Cow::Borrowed(HL_CLIENT_KEY_BATCH_1_FILENAME), + compressed: false, + compact: true, +}; + +const HL_COMPRESSED_COMPACT_PUBKEY_TEST: HlPublicKeyTest = HlPublicKeyTest { + test_filename: Cow::Borrowed("compressed_compact_public_key"), + client_key_filename: Cow::Borrowed(HL_CLIENT_KEY_BATCH_1_FILENAME), + compressed: true, + compact: true, +}; + +const HL_CT1_TEST: HlCiphertextTest = HlCiphertextTest { + test_filename: Cow::Borrowed("ct1"), + key_filename: Cow::Borrowed(HL_CLIENT_KEY_BATCH_1_FILENAME), + compressed: false, + compact: false, + clear_value: 0, +}; + +const HL_CT2_TEST: HlCiphertextTest = HlCiphertextTest { + test_filename: Cow::Borrowed("ct2"), + key_filename: Cow::Borrowed(HL_CLIENT_KEY_BATCH_1_FILENAME), + compressed: false, + compact: false, + clear_value: 255, +}; + +const HL_COMPRESSED_SEEDED_CT_TEST: HlCiphertextTest = HlCiphertextTest { + test_filename: Cow::Borrowed("ct_compressed_seeded"), + key_filename: Cow::Borrowed(HL_CLIENT_KEY_BATCH_1_FILENAME), + compressed: true, + compact: false, + clear_value: 255, }; +const HL_COMPRESSED_CT_MODSWITCHED_TEST: HlCiphertextTest = HlCiphertextTest { + test_filename: Cow::Borrowed("ct_compressed_modswitched"), + key_filename: Cow::Borrowed(HL_CLIENT_KEY_BATCH_1_FILENAME), + compressed: true, + compact: false, + clear_value: 255, +}; + +const HL_SIGNED_CT1_TEST: HlSignedCiphertextTest = HlSignedCiphertextTest { + test_filename: Cow::Borrowed("ct1_signed"), + key_filename: Cow::Borrowed(HL_CLIENT_KEY_BATCH_1_FILENAME), + compressed: false, + compact: false, + clear_value: 0, +}; + +const HL_SIGNED_CT2_TEST: HlSignedCiphertextTest = HlSignedCiphertextTest { + test_filename: Cow::Borrowed("ct2_signed"), + key_filename: Cow::Borrowed(HL_CLIENT_KEY_BATCH_1_FILENAME), + compressed: false, + compact: false, + clear_value: -127, +}; + +const HL_SIGNED_COMPRESSED_SEEDED_CT_TEST: HlSignedCiphertextTest = HlSignedCiphertextTest { + test_filename: Cow::Borrowed("ct_compressed_seeded_signed"), + key_filename: Cow::Borrowed(HL_CLIENT_KEY_BATCH_1_FILENAME), + compressed: true, + compact: false, + clear_value: 255, +}; + +const HL_SIGNED_COMPRESSED_CT_MODSWITCHED_TEST: HlSignedCiphertextTest = HlSignedCiphertextTest { + test_filename: Cow::Borrowed("ct_compressed_modswitched_signed"), + key_filename: Cow::Borrowed(HL_CLIENT_KEY_BATCH_1_FILENAME), + compressed: true, + compact: false, + clear_value: 255, +}; + +const HL_BOOL1_TEST: HlBoolCiphertextTest = HlBoolCiphertextTest { + test_filename: Cow::Borrowed("bool1"), + key_filename: Cow::Borrowed(HL_CLIENT_KEY_BATCH_1_FILENAME), + compressed: false, + compact: false, + clear_value: true, +}; + +const HL_BOOL2_TEST: HlBoolCiphertextTest = HlBoolCiphertextTest { + test_filename: Cow::Borrowed("bool2"), + key_filename: Cow::Borrowed(HL_CLIENT_KEY_BATCH_1_FILENAME), + compressed: false, + compact: false, + clear_value: false, +}; + +const HL_COMPACT_BOOL_TEST: HlBoolCiphertextTest = HlBoolCiphertextTest { + test_filename: Cow::Borrowed("compact_bool"), + key_filename: Cow::Borrowed(HL_CLIENT_KEY_BATCH_1_FILENAME), + compressed: false, + compact: true, + clear_value: true, +}; + +const HL_COMPRESSED_BOOL_SEEDED_TEST: HlBoolCiphertextTest = HlBoolCiphertextTest { + test_filename: Cow::Borrowed("compressed_seeded_bool"), + key_filename: Cow::Borrowed(HL_CLIENT_KEY_BATCH_1_FILENAME), + compressed: true, + compact: false, + clear_value: true, +}; + +const HL_COMPRESSED_BOOL_MODSWITCHED_TEST: HlBoolCiphertextTest = HlBoolCiphertextTest { + test_filename: Cow::Borrowed("compressed_modswitched_bool"), + key_filename: Cow::Borrowed(HL_CLIENT_KEY_BATCH_1_FILENAME), + compressed: true, + compact: false, + clear_value: true, +}; + +// Batch 2 +const HL_CLIENT_KEY_BATCH_2_FILENAME: &str = "batch_2_client_key"; + +const HL_COMPACTLIST_TEST: HlHeterogeneousCiphertextListTest = HlHeterogeneousCiphertextListTest { + test_filename: Cow::Borrowed("hl_heterogeneous_list"), + key_filename: Cow::Borrowed(HL_CLIENT_KEY_BATCH_2_FILENAME), + clear_values: Cow::Borrowed(&[17u8 as u64, -12i8 as u64, false as u64, true as u64]), + data_kinds: Cow::Borrowed(&[ + DataKind::Unsigned, + DataKind::Signed, + DataKind::Bool, + DataKind::Bool, + ]), + compressed: false, + proof_info: None, +}; + +const HL_PACKED_COMPACTLIST_TEST: HlHeterogeneousCiphertextListTest = + HlHeterogeneousCiphertextListTest { + test_filename: Cow::Borrowed("hl_packed_heterogeneous_list"), + key_filename: Cow::Borrowed(HL_CLIENT_KEY_BATCH_2_FILENAME), + clear_values: HL_COMPACTLIST_TEST.clear_values, + data_kinds: HL_COMPACTLIST_TEST.data_kinds, + compressed: false, + proof_info: None, + }; + +const HL_COMPRESSED_LIST_TEST: HlHeterogeneousCiphertextListTest = + HlHeterogeneousCiphertextListTest { + test_filename: Cow::Borrowed("hl_compressed_heterogeneous_list"), + key_filename: Cow::Borrowed(HL_CLIENT_KEY_BATCH_2_FILENAME), + clear_values: Cow::Borrowed(&[17u8 as u64, -12i8 as u64, false as u64, true as u64]), + data_kinds: Cow::Borrowed(&[ + DataKind::Unsigned, + DataKind::Signed, + DataKind::Bool, + DataKind::Bool, + ]), + compressed: true, + proof_info: None, + }; + const HL_PROVEN_COMPACTLIST_TEST: HlHeterogeneousCiphertextListTest = HlHeterogeneousCiphertextListTest { test_filename: Cow::Borrowed("hl_proven_heterogeneous_list"), - key_filename: Cow::Borrowed("client_key.cbor"), + key_filename: Cow::Borrowed(HL_CLIENT_KEY_BATCH_2_FILENAME), clear_values: Cow::Borrowed(&[17u8 as u64, -12i8 as u64, false as u64, true as u64]), data_kinds: Cow::Borrowed(&[ DataKind::Unsigned, @@ -116,12 +347,41 @@ const HL_PROVEN_COMPACTLIST_TEST: HlHeterogeneousCiphertextListTest = ]), compressed: false, proof_info: Some(PkeZkProofAuxilliaryInfo { - public_key_filename: Cow::Borrowed("public_key.cbor"), - params_filename: Cow::Borrowed("zk_pke_public_params.cbor"), + public_key_filename: Cow::Borrowed("public_key"), + params_filename: Cow::Borrowed("zk_pke_public_params"), metadata: Cow::Borrowed("drawkcab"), }), }; +const ZK_PKE_PUBLIC_PARAMS_TEST: ZkPkePublicParamsTest = ZkPkePublicParamsTest { + test_filename: Cow::Borrowed("zk_pke_public_params"), + lwe_dimension: VALID_TEST_PARAMS_TUNIFORM.polynomial_size + * VALID_TEST_PARAMS_TUNIFORM.glwe_dimension, // Lwe dimension of the "big" key is glwe dimension * polynomial size + max_num_cleartext: 16, + noise_bound: match VALID_TEST_PARAMS_TUNIFORM.lwe_noise_distribution { + TestDistribution::Gaussian { .. } => unreachable!(), + TestDistribution::TUniform { bound_log2 } => bound_log2 as usize, + }, + ciphertext_modulus: VALID_TEST_PARAMS_TUNIFORM.ciphertext_modulus, + plaintext_modulus: VALID_TEST_PARAMS_TUNIFORM.message_modulus + * VALID_TEST_PARAMS_TUNIFORM.carry_modulus + * 2, // *2 for padding bit + padding_bit_count: 1, +}; + +const HL_CLIENT_W_COMP_KEY_BATCH_2_FILENAME: &str = "client_key_with_compression"; + +const HL_CLIENTKEY_WITH_COMPRESSION_TEST: HlClientKeyTest = HlClientKeyTest { + test_filename: Cow::Borrowed(HL_CLIENT_W_COMP_KEY_BATCH_2_FILENAME), + parameters: VALID_TEST_PARAMS_TUNIFORM, +}; + +const HL_SERVERKEY_WITH_COMPRESSION_TEST: HlServerKeyTest = HlServerKeyTest { + test_filename: Cow::Borrowed("server_key_with_compression"), + client_key_filename: Cow::Borrowed(HL_CLIENT_W_COMP_KEY_BATCH_2_FILENAME), + compressed: false, +}; + pub struct V0_8; impl TfhersVersion for V0_8 { @@ -139,82 +399,328 @@ impl TfhersVersion for V0_8 { } fn gen_shortint_data() -> Vec { - Vec::new() + let dir = Self::data_dir().join(SHORTINT_MODULE_NAME); + create_dir_all(&dir).unwrap(); + + // generate a client key + let shortint_client_key = shortint::ClientKey::new(SHORTINT_CLIENTKEY_TEST.parameters); + + store_versioned_test!( + &shortint_client_key, + &dir, + &SHORTINT_CLIENTKEY_TEST.test_filename, + ); + + // generate ciphertexts + let ct1 = shortint_client_key.encrypt(SHORTINT_CT1_TEST.clear_value); + let ct2 = shortint_client_key.encrypt(SHORTINT_CT2_TEST.clear_value); + + // Serialize them + store_versioned_test!(&ct1, &dir, &SHORTINT_CT1_TEST.test_filename); + store_versioned_test!(&ct2, &dir, &SHORTINT_CT2_TEST.test_filename); + + vec![ + TestMetadata::ShortintClientKey(SHORTINT_CLIENTKEY_TEST), + TestMetadata::ShortintCiphertext(SHORTINT_CT1_TEST), + TestMetadata::ShortintCiphertext(SHORTINT_CT2_TEST), + ] } fn gen_hl_data() -> Vec { let dir = Self::data_dir().join(HL_MODULE_NAME); create_dir_all(&dir).unwrap(); - // Generate a compact public key needed to create a compact list - let config = - tfhe_0_8::ConfigBuilder::with_custom_parameters(VALID_TEST_PARAMS_TUNIFORM).build(); - let hl_client_key = ClientKey::generate(config); - let compact_pub_key = CompactPublicKey::new(&hl_client_key); - - let mut zk_rng: RandomGenerator = - RandomGenerator::new(Seed(PRNG_SEED)); - let crs = CompactPkeCrs::new( - LweDimension(ZK_PKE_PUBLIC_PARAMS_TEST.lwe_dimension), - ZK_PKE_PUBLIC_PARAMS_TEST.max_num_cleartext, - TUniform::::new(ZK_PKE_PUBLIC_PARAMS_TEST.noise_bound as u32), - CiphertextModulus::new(ZK_PKE_PUBLIC_PARAMS_TEST.ciphertext_modulus), - ZK_PKE_PUBLIC_PARAMS_TEST.plaintext_modulus as u64, - ZkMSBZeroPaddingBitCount(ZK_PKE_PUBLIC_PARAMS_TEST.padding_bit_count as u64), - &mut zk_rng, - ) - .unwrap(); - - // Store the associated client key to be able to decrypt the ciphertexts in the list - store_versioned_auxiliary!( - &hl_client_key, - &dir, - &HL_PROVEN_COMPACTLIST_TEST.key_filename - ); + let mut all_tests = vec![]; - store_versioned_auxiliary!( - &compact_pub_key, - &dir, - &HL_PROVEN_COMPACTLIST_TEST - .proof_info - .unwrap() - .public_key_filename - ); + { + // generate keys + let config = + ConfigBuilder::with_custom_parameters(HL_CLIENTKEY_TEST.parameters).build(); + let (hl_client_key, hl_server_key) = generate_keys(config); - let mut proven_builder = ProvenCompactCiphertextList::builder(&compact_pub_key); - proven_builder - .push(HL_PROVEN_COMPACTLIST_TEST.clear_values[0] as u8) - .push(HL_PROVEN_COMPACTLIST_TEST.clear_values[1] as i8) - .push(HL_PROVEN_COMPACTLIST_TEST.clear_values[2] != 0) - .push(HL_PROVEN_COMPACTLIST_TEST.clear_values[3] != 0); + // Here we use specific parameters to generate a smaller public key. + // WARNING: these parameters are completely insecure + let params_pk = INSECURE_SMALL_PK_TEST_PARAMS; + let client_key_for_pk = + ClientKey::generate(ConfigBuilder::with_custom_parameters(params_pk).build()); - let proven_list_packed = proven_builder - .build_with_proof_packed( - crs.public_params(), - HL_PROVEN_COMPACTLIST_TEST - .proof_info - .unwrap() - .metadata - .as_bytes(), - ZkComputeLoad::Proof, + let pub_key = PublicKey::new(&client_key_for_pk); + let compressed_pub_key = CompressedPublicKey::new(&hl_client_key); + let compact_pub_key = CompactPublicKey::new(&hl_client_key); + let compressed_compact_pub_key = CompressedCompactPublicKey::new(&hl_client_key); + + store_versioned_test!(&hl_client_key, &dir, &HL_CLIENTKEY_TEST.test_filename); + + store_versioned_test!(&hl_server_key, &dir, &HL_SERVERKEY_TEST.test_filename); + store_versioned_test!(&pub_key, &dir, &HL_LEGACY_PUBKEY_TEST.test_filename); + store_versioned_auxiliary!( + &client_key_for_pk, + &dir, + &HL_LEGACY_PUBKEY_TEST.client_key_filename, + ); + + store_versioned_test!( + &compressed_pub_key, + &dir, + &HL_COMPRESSED_LEGACY_PUBKEY_TEST.test_filename, + ); + store_versioned_test!( + &compact_pub_key, + &dir, + &HL_COMPACT_PUBKEY_TEST.test_filename, + ); + store_versioned_test!( + &compressed_compact_pub_key, + &dir, + &HL_COMPRESSED_COMPACT_PUBKEY_TEST.test_filename, + ); + + set_server_key(hl_server_key); + + // generate ciphertexts + let ct1 = FheUint8::encrypt(HL_CT1_TEST.clear_value, &hl_client_key); + let ct2 = FheUint8::encrypt(HL_CT2_TEST.clear_value, &hl_client_key); + + let ct1_signed = FheInt8::encrypt(HL_SIGNED_CT1_TEST.clear_value, &hl_client_key); + let ct2_signed = FheInt8::encrypt(HL_SIGNED_CT2_TEST.clear_value, &hl_client_key); + + let bool1 = FheBool::encrypt(HL_BOOL1_TEST.clear_value, &hl_client_key); + let bool2 = FheBool::encrypt(HL_BOOL2_TEST.clear_value, &hl_client_key); + + // Generate compressed ciphertexts + // The first one using seeded (default) method + let compressed_ct1 = CompressedFheUint8::encrypt( + HL_COMPRESSED_SEEDED_CT_TEST.clear_value, + &hl_client_key, + ); + let compressed_ct1_signed = CompressedFheInt8::encrypt( + HL_SIGNED_COMPRESSED_SEEDED_CT_TEST.clear_value, + &hl_client_key, + ); + let compressed_bool1 = CompressedFheBool::encrypt( + HL_COMPRESSED_BOOL_SEEDED_TEST.clear_value, + &hl_client_key, + ); + + // The second one using the modulus switched method + let compressed_ct2 = FheUint8::encrypt( + HL_COMPRESSED_CT_MODSWITCHED_TEST.clear_value, + &hl_client_key, + ) + .compress(); + let compressed_ct2_signed = FheInt8::encrypt( + HL_SIGNED_COMPRESSED_CT_MODSWITCHED_TEST.clear_value, + &hl_client_key, + ) + .compress(); + let compressed_bool2 = CompressedFheBool::encrypt( + HL_COMPRESSED_BOOL_MODSWITCHED_TEST.clear_value, + &hl_client_key, + ); + + // Serialize them + store_versioned_test!(&ct1, &dir, &HL_CT1_TEST.test_filename); + store_versioned_test!(&ct2, &dir, &HL_CT2_TEST.test_filename); + store_versioned_test!( + &compressed_ct1, + &dir, + &HL_COMPRESSED_SEEDED_CT_TEST.test_filename, + ); + store_versioned_test!( + &compressed_ct2, + &dir, + &HL_COMPRESSED_CT_MODSWITCHED_TEST.test_filename, + ); + + store_versioned_test!(&ct1_signed, &dir, &HL_SIGNED_CT1_TEST.test_filename); + store_versioned_test!(&ct2_signed, &dir, &HL_SIGNED_CT2_TEST.test_filename); + store_versioned_test!( + &compressed_ct1_signed, + &dir, + &HL_SIGNED_COMPRESSED_SEEDED_CT_TEST.test_filename, + ); + store_versioned_test!( + &compressed_ct2_signed, + &dir, + &HL_SIGNED_COMPRESSED_CT_MODSWITCHED_TEST.test_filename, + ); + + store_versioned_test!(&bool1, &dir, &HL_BOOL1_TEST.test_filename); + store_versioned_test!(&bool2, &dir, &HL_BOOL2_TEST.test_filename); + store_versioned_test!( + &compressed_bool1, + &dir, + &HL_COMPRESSED_BOOL_SEEDED_TEST.test_filename, + ); + store_versioned_test!( + &compressed_bool2, + &dir, + &HL_COMPRESSED_BOOL_MODSWITCHED_TEST.test_filename, + ); + + let test_batch_1 = [ + TestMetadata::HlClientKey(HL_CLIENTKEY_TEST), + TestMetadata::HlServerKey(HL_SERVERKEY_TEST), + TestMetadata::HlPublicKey(HL_LEGACY_PUBKEY_TEST), + TestMetadata::HlPublicKey(HL_COMPRESSED_LEGACY_PUBKEY_TEST), + TestMetadata::HlPublicKey(HL_COMPACT_PUBKEY_TEST), + TestMetadata::HlPublicKey(HL_COMPRESSED_COMPACT_PUBKEY_TEST), + TestMetadata::HlCiphertext(HL_CT1_TEST), + TestMetadata::HlCiphertext(HL_CT2_TEST), + TestMetadata::HlCiphertext(HL_COMPRESSED_SEEDED_CT_TEST), + TestMetadata::HlCiphertext(HL_COMPRESSED_CT_MODSWITCHED_TEST), + TestMetadata::HlSignedCiphertext(HL_SIGNED_CT1_TEST), + TestMetadata::HlSignedCiphertext(HL_SIGNED_CT2_TEST), + TestMetadata::HlSignedCiphertext(HL_SIGNED_COMPRESSED_SEEDED_CT_TEST), + TestMetadata::HlSignedCiphertext(HL_SIGNED_COMPRESSED_CT_MODSWITCHED_TEST), + TestMetadata::HlBoolCiphertext(HL_BOOL1_TEST), + TestMetadata::HlBoolCiphertext(HL_BOOL2_TEST), + TestMetadata::HlBoolCiphertext(HL_COMPRESSED_BOOL_SEEDED_TEST), + TestMetadata::HlBoolCiphertext(HL_COMPRESSED_BOOL_MODSWITCHED_TEST), + TestMetadata::HlBoolCiphertext(HL_COMPACT_BOOL_TEST), + ]; + all_tests.extend(test_batch_1); + } + + { + // Generate a compact public key needed to create a compact list + let config = + tfhe_0_8::ConfigBuilder::with_custom_parameters(VALID_TEST_PARAMS_TUNIFORM) + .enable_compression(VALID_TEST_PARAMS_TUNIFORM_COMPRESSION.into()) + .build(); + let hl_client_key = ClientKey::generate(config); + let hl_server_key = ServerKey::new(&hl_client_key); + set_server_key(hl_server_key.clone()); + let compact_pub_key = CompactPublicKey::new(&hl_client_key); + + let mut zk_rng: RandomGenerator = + RandomGenerator::new(Seed(PRNG_SEED)); + let crs = CompactPkeCrs::new( + LweDimension(ZK_PKE_PUBLIC_PARAMS_TEST.lwe_dimension), + ZK_PKE_PUBLIC_PARAMS_TEST.max_num_cleartext, + TUniform::::new(ZK_PKE_PUBLIC_PARAMS_TEST.noise_bound as u32), + CiphertextModulus::new(ZK_PKE_PUBLIC_PARAMS_TEST.ciphertext_modulus), + ZK_PKE_PUBLIC_PARAMS_TEST.plaintext_modulus as u64, + ZkMSBZeroPaddingBitCount(ZK_PKE_PUBLIC_PARAMS_TEST.padding_bit_count as u64), + &mut zk_rng, ) .unwrap(); - store_versioned_test!( - crs.public_params(), - &dir, - &ZK_PKE_PUBLIC_PARAMS_TEST.test_filename, - ); + // Store the associated client key to be able to decrypt the ciphertexts in the list + store_versioned_auxiliary!( + &hl_client_key, + &dir, + &HL_PROVEN_COMPACTLIST_TEST.key_filename + ); - store_versioned_test!( - &proven_list_packed, - &dir, - &HL_PROVEN_COMPACTLIST_TEST.test_filename, - ); + store_versioned_auxiliary!( + &compact_pub_key, + &dir, + &HL_PROVEN_COMPACTLIST_TEST + .proof_info + .unwrap() + .public_key_filename + ); - vec![ - TestMetadata::ZkPkePublicParams(ZK_PKE_PUBLIC_PARAMS_TEST), - TestMetadata::HlHeterogeneousCiphertextList(HL_PROVEN_COMPACTLIST_TEST), - ] + let mut proven_builder = ProvenCompactCiphertextList::builder(&compact_pub_key); + proven_builder + .push(HL_PROVEN_COMPACTLIST_TEST.clear_values[0] as u8) + .push(HL_PROVEN_COMPACTLIST_TEST.clear_values[1] as i8) + .push(HL_PROVEN_COMPACTLIST_TEST.clear_values[2] != 0) + .push(HL_PROVEN_COMPACTLIST_TEST.clear_values[3] != 0); + + let proven_list_packed = proven_builder + .build_with_proof_packed( + crs.public_params(), + HL_PROVEN_COMPACTLIST_TEST + .proof_info + .unwrap() + .metadata + .as_bytes(), + ZkComputeLoad::Proof, + ) + .unwrap(); + + store_versioned_test!( + crs.public_params(), + &dir, + &ZK_PKE_PUBLIC_PARAMS_TEST.test_filename, + ); + + store_versioned_test!( + &proven_list_packed, + &dir, + &HL_PROVEN_COMPACTLIST_TEST.test_filename, + ); + + // Generate heterogeneous list data + let mut compact_builder = CompactCiphertextList::builder(&compact_pub_key); + compact_builder + .push(HL_COMPACTLIST_TEST.clear_values[0] as u8) + .push(HL_COMPACTLIST_TEST.clear_values[1] as i8) + .push(HL_COMPACTLIST_TEST.clear_values[2] != 0) + .push(HL_COMPACTLIST_TEST.clear_values[3] != 0); + + let compact_list_packed = compact_builder.build_packed(); + let compact_list = compact_builder.build(); + + let mut compressed_builder = CompressedCiphertextListBuilder::new(); + compressed_builder + .push(FheUint8::encrypt( + HL_COMPRESSED_LIST_TEST.clear_values[0] as u8, + &hl_client_key, + )) + .push(FheInt8::encrypt( + HL_COMPRESSED_LIST_TEST.clear_values[1] as i8, + &hl_client_key, + )) + .push(FheBool::encrypt( + HL_COMPRESSED_LIST_TEST.clear_values[2] != 0, + &hl_client_key, + )) + .push(FheBool::encrypt( + HL_COMPRESSED_LIST_TEST.clear_values[3] != 0, + &hl_client_key, + )); + let compressed_list = compressed_builder.build().unwrap(); + + store_versioned_test!( + &compact_list_packed, + &dir, + &HL_PACKED_COMPACTLIST_TEST.test_filename, + ); + store_versioned_test!(&compact_list, &dir, &HL_COMPACTLIST_TEST.test_filename); + store_versioned_test!( + &compressed_list, + &dir, + &HL_COMPRESSED_LIST_TEST.test_filename, + ); + + store_versioned_test!( + &hl_client_key, + &dir, + &HL_CLIENTKEY_WITH_COMPRESSION_TEST.test_filename, + ); + + store_versioned_test!( + &hl_server_key, + &dir, + &HL_SERVERKEY_WITH_COMPRESSION_TEST.test_filename, + ); + + let test_batch_2 = [ + TestMetadata::HlHeterogeneousCiphertextList(HL_COMPACTLIST_TEST), + TestMetadata::HlHeterogeneousCiphertextList(HL_PACKED_COMPACTLIST_TEST), + TestMetadata::HlHeterogeneousCiphertextList(HL_COMPRESSED_LIST_TEST), + TestMetadata::HlHeterogeneousCiphertextList(HL_PROVEN_COMPACTLIST_TEST), + TestMetadata::ZkPkePublicParams(ZK_PKE_PUBLIC_PARAMS_TEST), + TestMetadata::HlClientKey(HL_CLIENTKEY_WITH_COMPRESSION_TEST), + TestMetadata::HlServerKey(HL_SERVERKEY_WITH_COMPRESSION_TEST), + ]; + + all_tests.extend(test_batch_2); + } + + all_tests } } diff --git a/src/data_0_9.rs b/src/data_0_9.rs new file mode 100644 index 0000000..46c2bbb --- /dev/null +++ b/src/data_0_9.rs @@ -0,0 +1,159 @@ +use crate::generate::{ + store_versioned_test_tfhe_09, TfhersVersion, VALID_TEST_PARAMS_TUNIFORM, + VALID_TEST_PARAMS_TUNIFORM_COMPRESSION, +}; +use crate::{ + HlClientKeyTest, HlServerKeyTest, TestCompressionParameterSet, TestDistribution, TestMetadata, + TestParameterSet, HL_MODULE_NAME, +}; +use std::{borrow::Cow, fs::create_dir_all}; +use tfhe_0_9::{ + boolean::engine::BooleanEngine, + core_crypto::commons::generators::DeterministicSeeder, + core_crypto::commons::math::random::ActivatedRandomGenerator, + core_crypto::prelude::{CiphertextModulusLog, LweCiphertextCount}, + shortint::engine::ShortintEngine, + shortint::parameters::{ + CarryModulus, CiphertextModulus, ClassicPBSParameters, CompressionParameters, + DecompositionBaseLog, DecompositionLevelCount, DynamicDistribution, EncryptionKeyChoice, + GlweDimension, LweDimension, MaxNoiseLevel, MessageModulus, PBSParameters, PolynomialSize, + StandardDev, + }, + ClientKey, CompressedServerKey, Seed, +}; + +macro_rules! store_versioned_test { + ($msg:expr, $dir:expr, $test_filename:expr $(,)? ) => { + store_versioned_test_tfhe_09($msg, $dir, $test_filename) + }; +} + +impl From for DynamicDistribution { + fn from(value: TestDistribution) -> Self { + match value { + TestDistribution::Gaussian { stddev } => { + DynamicDistribution::new_gaussian_from_std_dev(StandardDev(stddev)) + } + TestDistribution::TUniform { bound_log2 } => { + DynamicDistribution::new_t_uniform(bound_log2) + } + } + } +} + +impl From for ClassicPBSParameters { + fn from(value: TestParameterSet) -> Self { + ClassicPBSParameters { + lwe_dimension: LweDimension(value.lwe_dimension), + glwe_dimension: GlweDimension(value.glwe_dimension), + polynomial_size: PolynomialSize(value.polynomial_size), + lwe_noise_distribution: value.lwe_noise_distribution.into(), + glwe_noise_distribution: value.glwe_noise_distribution.into(), + pbs_base_log: DecompositionBaseLog(value.pbs_base_log), + pbs_level: DecompositionLevelCount(value.pbs_level), + ks_base_log: DecompositionBaseLog(value.ks_base_log), + ks_level: DecompositionLevelCount(value.ks_level), + message_modulus: MessageModulus(value.message_modulus), + carry_modulus: CarryModulus(value.carry_modulus), + max_noise_level: MaxNoiseLevel::new(value.max_noise_level), + log2_p_fail: value.log2_p_fail, + ciphertext_modulus: CiphertextModulus::try_new(value.ciphertext_modulus).unwrap(), + encryption_key_choice: { + match &*value.encryption_key_choice { + "big" => EncryptionKeyChoice::Big, + "small" => EncryptionKeyChoice::Small, + _ => panic!("Invalid encryption key choice"), + } + }, + } + } +} + +impl From for PBSParameters { + fn from(value: TestParameterSet) -> Self { + let tmp: ClassicPBSParameters = value.into(); + tmp.into() + } +} + +impl From for CompressionParameters { + fn from(value: TestCompressionParameterSet) -> Self { + let TestCompressionParameterSet { + br_level, + br_base_log, + packing_ks_level, + packing_ks_base_log, + packing_ks_polynomial_size, + packing_ks_glwe_dimension, + lwe_per_glwe, + storage_log_modulus, + packing_ks_key_noise_distribution, + } = value; + Self { + br_level: DecompositionLevelCount(br_level), + br_base_log: DecompositionBaseLog(br_base_log), + packing_ks_level: DecompositionLevelCount(packing_ks_level), + packing_ks_base_log: DecompositionBaseLog(packing_ks_base_log), + packing_ks_polynomial_size: PolynomialSize(packing_ks_polynomial_size), + packing_ks_glwe_dimension: GlweDimension(packing_ks_glwe_dimension), + lwe_per_glwe: LweCiphertextCount(lwe_per_glwe), + storage_log_modulus: CiphertextModulusLog(storage_log_modulus), + packing_ks_key_noise_distribution: packing_ks_key_noise_distribution.into(), + } + } +} + +const HL_CLIENTKEY_TEST: HlClientKeyTest = HlClientKeyTest { + test_filename: Cow::Borrowed("client_key"), + parameters: VALID_TEST_PARAMS_TUNIFORM, +}; + +const HL_COMPRESSED_SERVERKEY_TEST: HlServerKeyTest = HlServerKeyTest { + test_filename: Cow::Borrowed("compressed_server_key"), + client_key_filename: Cow::Borrowed("client_key.cbor"), + compressed: true, +}; + +pub struct V0_9; + +impl TfhersVersion for V0_9 { + const VERSION_NUMBER: &'static str = "0.9"; + + fn seed_prng(seed: u128) { + let mut seeder = DeterministicSeeder::::new(Seed(seed)); + let shortint_engine = ShortintEngine::new_from_seeder(&mut seeder); + ShortintEngine::with_thread_local_mut(|local_engine| { + let _ = std::mem::replace(local_engine, shortint_engine); + }); + + let boolean_engine = BooleanEngine::new_from_seeder(&mut seeder); + BooleanEngine::replace_thread_local(boolean_engine); + } + + fn gen_shortint_data() -> Vec { + Vec::new() + } + + fn gen_hl_data() -> Vec { + let dir = Self::data_dir().join(HL_MODULE_NAME); + create_dir_all(&dir).unwrap(); + + let config = tfhe_0_9::ConfigBuilder::with_custom_parameters(HL_CLIENTKEY_TEST.parameters) + .enable_compression(VALID_TEST_PARAMS_TUNIFORM_COMPRESSION.into()) + .build(); + let hl_client_key = ClientKey::generate(config); + let compressed_server_key = CompressedServerKey::new(&hl_client_key); + + store_versioned_test!(&hl_client_key, &dir, &HL_CLIENTKEY_TEST.test_filename); + store_versioned_test!( + &compressed_server_key, + &dir, + &HL_COMPRESSED_SERVERKEY_TEST.test_filename, + ); + + vec![ + TestMetadata::HlClientKey(HL_CLIENTKEY_TEST), + TestMetadata::HlServerKey(HL_COMPRESSED_SERVERKEY_TEST), + ] + } +} diff --git a/src/generate.rs b/src/generate.rs index bb57ffe..0e62afd 100644 --- a/src/generate.rs +++ b/src/generate.rs @@ -6,11 +6,13 @@ use std::{ use bincode::Options; use serde::Serialize; -use tfhe_versionable_0_1::Versionize as Versionize01; -use tfhe_versionable_0_2::Versionize as Versionize02; -use tfhe_versionable_0_3::Versionize as Versionize03; +use tfhe_0_8_versionable::Versionize as VersionizeTfhe08; +use tfhe_0_9_versionable::Versionize as VersionizeTfhe09; -use crate::{data_dir, dir_for_version, TestDistribution, TestMetadata, TestParameterSet}; +use crate::{ + data_dir, dir_for_version, TestCompressionParameterSet, TestDistribution, TestMetadata, + TestParameterSet, +}; pub const PRNG_SEED: u128 = 0xdeadbeef; @@ -51,10 +53,47 @@ pub const VALID_TEST_PARAMS_TUNIFORM: TestParameterSet = TestParameterSet { carry_modulus: 4, max_noise_level: 5, log2_p_fail: -64.138, - ciphertext_modulus: (u64::MAX as u128) + 1, + ciphertext_modulus: 1 << 64, encryption_key_choice: Cow::Borrowed("big"), }; +/// Those parameters are insecure and are used to generate small legacy public keys +pub const INSECURE_SMALL_PK_TEST_PARAMS: TestParameterSet = TestParameterSet { + lwe_dimension: 10, + glwe_dimension: 4, + polynomial_size: 512, + lwe_noise_distribution: TestDistribution::Gaussian { + stddev: 1.499_900_593_439_687_3e-6, + }, + glwe_noise_distribution: TestDistribution::Gaussian { + stddev: 2.845267479601915e-15, + }, + pbs_base_log: 23, + pbs_level: 1, + ks_base_log: 5, + ks_level: 3, + message_modulus: 2, + carry_modulus: 2, + max_noise_level: 3, + log2_p_fail: -64.05, + ciphertext_modulus: 1 << 64, + encryption_key_choice: Cow::Borrowed("small"), +}; + +// Compression parameters for 2_2 TUniform +pub const VALID_TEST_PARAMS_TUNIFORM_COMPRESSION: TestCompressionParameterSet = + TestCompressionParameterSet { + br_level: 1, + br_base_log: 23, + packing_ks_level: 4, + packing_ks_base_log: 4, + packing_ks_polynomial_size: 256, + packing_ks_glwe_dimension: 4, + lwe_per_glwe: 256, + storage_log_modulus: 12, + packing_ks_key_noise_distribution: TestDistribution::TUniform { bound_log2: 42 }, + }; + /// Invalid parameter set to test the limits pub const INVALID_TEST_PARAMS: TestParameterSet = TestParameterSet { lwe_dimension: usize::MAX, @@ -75,11 +114,28 @@ pub const INVALID_TEST_PARAMS: TestParameterSet = TestParameterSet { }; pub fn save_cbor>(msg: &Data, path: P) { + let path = path.as_ref(); + if path.exists() { + panic!( + "Error while saving {}, file already exists, \ + indicating an error in the test file organization.", + path.display() + ); + } let mut file = File::create(path).unwrap(); ciborium::ser::into_writer(msg, &mut file).unwrap(); } pub fn save_bcode>(msg: &Data, path: P) { + let path = path.as_ref(); + if path.exists() { + panic!( + "Error while saving {}, file already exists, \ + indicating an error in the test file organization.", + path.display() + ); + } + let mut file = File::create(path).unwrap(); let options = bincode::DefaultOptions::new().with_fixint_encoding(); options.serialize_into(&mut file, msg).unwrap(); @@ -105,9 +161,8 @@ macro_rules! define_store_versioned_test_fn { } }; } -define_store_versioned_test_fn!(store_versioned_test_01, Versionize01); -define_store_versioned_test_fn!(store_versioned_test_02, Versionize02); -define_store_versioned_test_fn!(store_versioned_test_03, Versionize03); +define_store_versioned_test_fn!(store_versioned_test_tfhe_08, VersionizeTfhe08); +define_store_versioned_test_fn!(store_versioned_test_tfhe_09, VersionizeTfhe09); /// Stores the auxiliary data in `dir`, encoded in cbor, using the right tfhe-versionable version macro_rules! define_store_versioned_auxiliary_fn { @@ -120,14 +175,13 @@ macro_rules! define_store_versioned_auxiliary_fn { let versioned = msg.versionize(); // Store in cbor - let filename_cbor = format!("{}", test_filename); + let filename_cbor = format!("{}.cbor", test_filename); save_cbor(&versioned, dir.as_ref().join(filename_cbor)); } }; } -define_store_versioned_auxiliary_fn!(store_versioned_auxiliary_01, Versionize01); -define_store_versioned_auxiliary_fn!(store_versioned_auxiliary_02, Versionize02); -define_store_versioned_auxiliary_fn!(store_versioned_auxiliary_03, Versionize03); +define_store_versioned_auxiliary_fn!(store_versioned_auxiliary_tfhe_08, VersionizeTfhe08); +define_store_versioned_auxiliary_fn!(store_versioned_auxiliary_tfhe_09, VersionizeTfhe09); pub fn store_metadata>(value: &Meta, path: P) { let serialized = ron::ser::to_string_pretty(value, ron::ser::PrettyConfig::default()).unwrap(); diff --git a/src/lib.rs b/src/lib.rs index ba51f49..e614822 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,13 +12,11 @@ use strum::Display; use serde::{Deserialize, Serialize}; -#[cfg(feature = "generate")] -pub mod data_0_6; -#[cfg(feature = "generate")] -pub mod data_0_7; #[cfg(feature = "generate")] pub mod data_0_8; #[cfg(feature = "generate")] +pub mod data_0_9; +#[cfg(feature = "generate")] pub mod generate; #[cfg(feature = "load")] pub mod load; @@ -52,6 +50,23 @@ pub struct TestParameterSet { pub encryption_key_choice: Cow<'static, str>, } +/// This struct re-defines tfhe-rs compression parameter sets but this allows to be independant +/// of changes made into the ParameterSet of tfhe-rs. The idea here is to define a type +/// that is able to carry the information of the used parameters without using any tfhe-rs +/// types. +#[derive(Serialize, Deserialize, Clone, Debug)] +pub struct TestCompressionParameterSet { + pub br_level: usize, + pub br_base_log: usize, + pub packing_ks_level: usize, + pub packing_ks_base_log: usize, + pub packing_ks_polynomial_size: usize, + pub packing_ks_glwe_dimension: usize, + pub lwe_per_glwe: usize, + pub storage_log_modulus: usize, + pub packing_ks_key_noise_distribution: TestDistribution, +} + /// Representation of a random distribution that is independant from any tfhe-rs version #[derive(Serialize, Deserialize, Clone, Debug)] pub enum TestDistribution { diff --git a/src/main.rs b/src/main.rs index 2e3d05d..b910aa9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,7 @@ +use std::fs::remove_dir_all; use tfhe_backward_compat_data::{ - data_0_6::V0_6, - data_0_7::V0_7, data_0_8::V0_8, + data_0_9::V0_9, data_dir, generate::{store_metadata, TfhersVersion, PRNG_SEED}, Testcase, HL_MODULE_NAME, SHORTINT_MODULE_NAME, @@ -34,9 +34,11 @@ fn gen_all_data() -> Vec { fn main() { let root_dir = env!("CARGO_MANIFEST_DIR"); - let mut testcases = gen_all_data::(); - testcases.extend(gen_all_data::()); - testcases.extend(gen_all_data::()); + let data_dir_path = data_dir(root_dir); + remove_dir_all(&data_dir_path).unwrap(); + + let mut testcases = gen_all_data::(); + testcases.extend(gen_all_data::()); let shortint_testcases: Vec = testcases .iter() @@ -44,7 +46,7 @@ fn main() { .cloned() .collect(); - store_metadata(&shortint_testcases, data_dir(root_dir).join("shortint.ron")); + store_metadata(&shortint_testcases, data_dir_path.join("shortint.ron")); let high_level_api_testcases: Vec = testcases .iter() @@ -54,6 +56,6 @@ fn main() { store_metadata( &high_level_api_testcases, - data_dir(root_dir).join("high_level_api.ron"), + data_dir_path.join("high_level_api.ron"), ); }