mirror of
https://github.com/zama-ai/tfhe-rs.git
synced 2026-01-07 22:04:10 -05:00
chore: rename concrete-csprng to tfhe-csprng
This commit is contained in:
8
.github/workflows/aws_tfhe_fast_tests.yml
vendored
8
.github/workflows/aws_tfhe_fast_tests.yml
vendored
@@ -63,13 +63,13 @@ jobs:
|
||||
files_yaml: |
|
||||
dependencies:
|
||||
- tfhe/Cargo.toml
|
||||
- concrete-csprng/**
|
||||
- tfhe-csprng/**
|
||||
- tfhe-fft/**
|
||||
- tfhe-zk-pok/**
|
||||
- utils/tfhe-versionable/**
|
||||
- utils/tfhe-versionable-derive/**
|
||||
csprng:
|
||||
- concrete-csprng/**
|
||||
- tfhe-csprng/**
|
||||
zk_pok:
|
||||
- tfhe-zk-pok/**
|
||||
versionable:
|
||||
@@ -162,10 +162,10 @@ jobs:
|
||||
with:
|
||||
toolchain: stable
|
||||
|
||||
- name: Run concrete-csprng tests
|
||||
- name: Run tfhe-csprng tests
|
||||
if: needs.should-run.outputs.csprng_test == 'true'
|
||||
run: |
|
||||
make test_concrete_csprng
|
||||
make test_tfhe_csprng
|
||||
|
||||
- name: Run tfhe-zk-pok tests
|
||||
if: needs.should-run.outputs.zk_pok_test == 'true'
|
||||
|
||||
2
.github/workflows/aws_tfhe_integer_tests.yml
vendored
2
.github/workflows/aws_tfhe_integer_tests.yml
vendored
@@ -52,7 +52,7 @@ jobs:
|
||||
files_yaml: |
|
||||
integer:
|
||||
- tfhe/Cargo.toml
|
||||
- concrete-csprng/**
|
||||
- tfhe-csprng/**
|
||||
- tfhe-fft/**
|
||||
- tfhe-zk-pok/**
|
||||
- tfhe/src/core_crypto/**
|
||||
|
||||
@@ -52,7 +52,7 @@ jobs:
|
||||
files_yaml: |
|
||||
integer:
|
||||
- tfhe/Cargo.toml
|
||||
- concrete-csprng/**
|
||||
- tfhe-csprng/**
|
||||
- tfhe-fft/**
|
||||
- tfhe-zk-pok/**
|
||||
- tfhe/src/core_crypto/**
|
||||
|
||||
8
.github/workflows/aws_tfhe_tests.yml
vendored
8
.github/workflows/aws_tfhe_tests.yml
vendored
@@ -72,11 +72,11 @@ jobs:
|
||||
files_yaml: |
|
||||
dependencies:
|
||||
- tfhe/Cargo.toml
|
||||
- concrete-csprng/**
|
||||
- tfhe-csprng/**
|
||||
- tfhe-fft/**
|
||||
- tfhe-zk-pok/**
|
||||
csprng:
|
||||
- concrete-csprng/**
|
||||
- tfhe-csprng/**
|
||||
zk_pok:
|
||||
- tfhe-zk-pok/**
|
||||
core_crypto:
|
||||
@@ -171,10 +171,10 @@ jobs:
|
||||
with:
|
||||
toolchain: stable
|
||||
|
||||
- name: Run concrete-csprng tests
|
||||
- name: Run tfhe-csprng tests
|
||||
if: needs.should-run.outputs.csprng_test == 'true'
|
||||
run: |
|
||||
make test_concrete_csprng
|
||||
make test_tfhe_csprng
|
||||
|
||||
- name: Run tfhe-zk-pok tests
|
||||
if: needs.should-run.outputs.zk_pok_test == 'true'
|
||||
|
||||
2
.github/workflows/benchmark_wasm_client.yml
vendored
2
.github/workflows/benchmark_wasm_client.yml
vendored
@@ -45,7 +45,7 @@ jobs:
|
||||
files_yaml: |
|
||||
wasm_bench:
|
||||
- tfhe/Cargo.toml
|
||||
- concrete-csprng/**
|
||||
- tfhe-csprng/**
|
||||
- tfhe-zk-pok/**
|
||||
- tfhe/src/**
|
||||
- '!tfhe/src/c_api/**'
|
||||
|
||||
2
.github/workflows/benchmark_zk_pke.yml
vendored
2
.github/workflows/benchmark_zk_pke.yml
vendored
@@ -49,7 +49,7 @@ jobs:
|
||||
files_yaml: |
|
||||
zk_pok:
|
||||
- tfhe/Cargo.toml
|
||||
- concrete-csprng/**
|
||||
- tfhe-csprng/**
|
||||
- tfhe-fft/**
|
||||
- tfhe-zk-pok/**
|
||||
- tfhe/src/core_crypto/**
|
||||
|
||||
4
.github/workflows/cargo_build.yml
vendored
4
.github/workflows/cargo_build.yml
vendored
@@ -47,10 +47,10 @@ jobs:
|
||||
run: |
|
||||
make pcc
|
||||
|
||||
- name: Build concrete-csprng
|
||||
- name: Build tfhe-csprng
|
||||
if: ${{ contains(matrix.os, 'ubuntu') }}
|
||||
run: |
|
||||
make build_concrete_csprng
|
||||
make build_tfhe_csprng
|
||||
|
||||
- name: Build Release core
|
||||
if: ${{ contains(matrix.os, 'ubuntu') }}
|
||||
|
||||
4
.github/workflows/code_coverage.yml
vendored
4
.github/workflows/code_coverage.yml
vendored
@@ -58,8 +58,8 @@ jobs:
|
||||
files_yaml: |
|
||||
tfhe:
|
||||
- tfhe/src/**
|
||||
concrete_csprng:
|
||||
- concrete-csprng/src/**
|
||||
tfhe_csprng:
|
||||
- tfhe-csprng/src/**
|
||||
|
||||
- name: Generate Keys
|
||||
if: steps.changed-files.outputs.tfhe_any_changed == 'true'
|
||||
|
||||
@@ -65,7 +65,7 @@ jobs:
|
||||
uses: rtCamp/action-slack-notify@c33737706dea87cd7784c687dadc9adf1be59990
|
||||
env:
|
||||
SLACK_COLOR: ${{ job.status }}
|
||||
SLACK_MESSAGE: "concrete-csprng randomness check finished with status: ${{ job.status }}. (${{ env.ACTION_RUN_URL }})"
|
||||
SLACK_MESSAGE: "tfhe-csprng randomness check finished with status: ${{ job.status }}. (${{ env.ACTION_RUN_URL }})"
|
||||
|
||||
teardown-instance:
|
||||
name: Teardown instance (csprng-randomness-tests)
|
||||
|
||||
8
.github/workflows/m1_tests.yml
vendored
8
.github/workflows/m1_tests.yml
vendored
@@ -84,9 +84,9 @@ jobs:
|
||||
run: |
|
||||
make pcc
|
||||
|
||||
- name: Build concrete-csprng
|
||||
- name: Build tfhe-csprng
|
||||
run: |
|
||||
make build_concrete_csprng
|
||||
make build_tfhe_csprng
|
||||
|
||||
- name: Build Release core
|
||||
run: |
|
||||
@@ -112,9 +112,9 @@ jobs:
|
||||
run: |
|
||||
make build_c_api
|
||||
|
||||
- name: Run concrete-csprng tests
|
||||
- name: Run tfhe-csprng tests
|
||||
run: |
|
||||
make test_concrete_csprng
|
||||
make test_tfhe_csprng
|
||||
|
||||
- name: Run tfhe-zk-pok tests
|
||||
run: |
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name: Publish concrete-csprng release
|
||||
name: Publish tfhe-csprng release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
@@ -19,7 +19,7 @@ jobs:
|
||||
READ_ORG_TOKEN: ${{ secrets.READ_ORG_TOKEN }}
|
||||
|
||||
publish_release:
|
||||
name: Publish concrete-csprng Release
|
||||
name: Publish tfhe-csprng Release
|
||||
needs: verify_tag
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@@ -33,7 +33,7 @@ jobs:
|
||||
CRATES_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
||||
DRY_RUN: ${{ inputs.dry_run && '--dry-run' || '' }}
|
||||
run: |
|
||||
cargo publish -p concrete-csprng --token ${{ env.CRATES_TOKEN }} ${{ env.DRY_RUN }}
|
||||
cargo publish -p tfhe-csprng --token ${{ env.CRATES_TOKEN }} ${{ env.DRY_RUN }}
|
||||
|
||||
- name: Slack Notification
|
||||
if: ${{ failure() }}
|
||||
@@ -43,6 +43,6 @@ jobs:
|
||||
SLACK_COLOR: ${{ job.status }}
|
||||
SLACK_CHANNEL: ${{ secrets.SLACK_CHANNEL }}
|
||||
SLACK_ICON: https://pbs.twimg.com/profile_images/1274014582265298945/OjBKP9kn_400x400.png
|
||||
SLACK_MESSAGE: "concrete-csprng release finished with status: ${{ job.status }}. (${{ env.ACTION_RUN_URL }})"
|
||||
SLACK_MESSAGE: "tfhe-csprng release finished with status: ${{ job.status }}. (${{ env.ACTION_RUN_URL }})"
|
||||
SLACK_USERNAME: ${{ secrets.BOT_USERNAME }}
|
||||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
|
||||
|
||||
@@ -7,7 +7,7 @@ members = [
|
||||
"tfhe-zk-pok",
|
||||
"tasks",
|
||||
"apps/trivium",
|
||||
"concrete-csprng",
|
||||
"tfhe-csprng",
|
||||
"backends/tfhe-cuda-backend",
|
||||
"utils/tfhe-versionable",
|
||||
"utils/tfhe-versionable-derive",
|
||||
|
||||
24
Makefile
24
Makefile
@@ -400,11 +400,11 @@ clippy_all_targets: install_rs_check_toolchain
|
||||
--features=$(TARGET_ARCH_FEATURE),boolean,shortint,integer,internal-keycache,zk-pok,strings,experimental \
|
||||
-p $(TFHE_SPEC) -- --no-deps -D warnings
|
||||
|
||||
.PHONY: clippy_concrete_csprng # Run clippy lints on concrete-csprng
|
||||
clippy_concrete_csprng: install_rs_check_toolchain
|
||||
.PHONY: clippy_tfhe_csprng # Run clippy lints on tfhe-csprng
|
||||
clippy_tfhe_csprng: install_rs_check_toolchain
|
||||
RUSTFLAGS="$(RUSTFLAGS)" cargo "$(CARGO_RS_CHECK_TOOLCHAIN)" clippy --all-targets \
|
||||
--features=$(TARGET_ARCH_FEATURE) \
|
||||
-p concrete-csprng -- --no-deps -D warnings
|
||||
-p tfhe-csprng -- --no-deps -D warnings
|
||||
|
||||
.PHONY: clippy_zk_pok # Run clippy lints on tfhe-zk-pok
|
||||
clippy_zk_pok: install_rs_check_toolchain
|
||||
@@ -420,12 +420,12 @@ clippy_versionable: install_rs_check_toolchain
|
||||
|
||||
.PHONY: clippy_all # Run all clippy targets
|
||||
clippy_all: clippy_rustdoc clippy clippy_boolean clippy_shortint clippy_integer clippy_all_targets \
|
||||
clippy_c_api clippy_js_wasm_api clippy_tasks clippy_core clippy_concrete_csprng clippy_zk_pok clippy_trivium \
|
||||
clippy_c_api clippy_js_wasm_api clippy_tasks clippy_core clippy_tfhe_csprng clippy_zk_pok clippy_trivium \
|
||||
clippy_versionable
|
||||
|
||||
.PHONY: clippy_fast # Run main clippy targets
|
||||
clippy_fast: clippy_rustdoc clippy clippy_all_targets clippy_c_api clippy_js_wasm_api clippy_tasks \
|
||||
clippy_core clippy_concrete_csprng
|
||||
clippy_core clippy_tfhe_csprng
|
||||
|
||||
.PHONY: clippy_cuda_backend # Run clippy lints on the tfhe-cuda-backend
|
||||
clippy_cuda_backend: install_rs_check_toolchain
|
||||
@@ -531,10 +531,10 @@ build_node_js_api: install_rs_build_toolchain install_wasm_pack
|
||||
wasm-pack build --release --target=nodejs \
|
||||
-- --features=boolean-client-js-wasm-api,shortint-client-js-wasm-api,integer-client-js-wasm-api,zk-pok
|
||||
|
||||
.PHONY: build_concrete_csprng # Build concrete_csprng
|
||||
build_concrete_csprng: install_rs_build_toolchain
|
||||
.PHONY: build_tfhe_csprng # Build tfhe_csprng
|
||||
build_tfhe_csprng: install_rs_build_toolchain
|
||||
RUSTFLAGS="$(RUSTFLAGS)" cargo $(CARGO_RS_BUILD_TOOLCHAIN) build --profile $(CARGO_PROFILE) \
|
||||
--features=$(TARGET_ARCH_FEATURE) -p concrete-csprng --all-targets
|
||||
--features=$(TARGET_ARCH_FEATURE) -p tfhe-csprng --all-targets
|
||||
|
||||
.PHONY: test_core_crypto # Run the tests of the core_crypto module including experimental ones
|
||||
test_core_crypto: install_rs_build_toolchain install_rs_check_toolchain
|
||||
@@ -847,10 +847,10 @@ test_kreyvium: install_rs_build_toolchain
|
||||
RUSTFLAGS="$(RUSTFLAGS)" cargo $(CARGO_RS_BUILD_TOOLCHAIN) test --profile $(CARGO_PROFILE) \
|
||||
-p tfhe-trivium -- --test-threads=1 kreyvium::
|
||||
|
||||
.PHONY: test_concrete_csprng # Run concrete-csprng tests
|
||||
test_concrete_csprng: install_rs_build_toolchain
|
||||
.PHONY: test_tfhe_csprng # Run tfhe-csprng tests
|
||||
test_tfhe_csprng: install_rs_build_toolchain
|
||||
RUSTFLAGS="$(RUSTFLAGS)" cargo $(CARGO_RS_BUILD_TOOLCHAIN) test --profile $(CARGO_PROFILE) \
|
||||
--features=$(TARGET_ARCH_FEATURE) -p concrete-csprng
|
||||
--features=$(TARGET_ARCH_FEATURE) -p tfhe-csprng
|
||||
|
||||
.PHONY: test_zk_pok # Run tfhe-zk-pok tests
|
||||
test_zk_pok: install_rs_build_toolchain
|
||||
@@ -1016,7 +1016,7 @@ no_dbg_log:
|
||||
@./scripts/no_dbg_calls.sh
|
||||
|
||||
.PHONY: dieharder_csprng # Run the dieharder test suite on our CSPRNG implementation
|
||||
dieharder_csprng: install_dieharder build_concrete_csprng
|
||||
dieharder_csprng: install_dieharder build_tfhe_csprng
|
||||
./scripts/dieharder_test.sh
|
||||
|
||||
#
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "concrete-csprng"
|
||||
name = "tfhe-csprng"
|
||||
version = "0.4.1"
|
||||
edition = "2021"
|
||||
license = "BSD-3-Clause-Clear"
|
||||
@@ -1,4 +1,4 @@
|
||||
# Concrete CSPRNG
|
||||
# TFHE-CSPRNG
|
||||
|
||||
This crate contains a fast *Cryptographically Secure Pseudorandom Number Generator*, used in the
|
||||
[TFHE-rs](https://crates.io/crates/tfhe) library, you can find it [here](../tfhe/) in this repo.
|
||||
@@ -1,8 +1,8 @@
|
||||
use concrete_csprng::generators::{
|
||||
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
||||
use tfhe_csprng::generators::{
|
||||
AesniRandomGenerator, BytesPerChild, ChildrenCount, RandomGenerator,
|
||||
};
|
||||
use concrete_csprng::seeders::{RdseedSeeder, Seeder};
|
||||
use criterion::{black_box, criterion_group, criterion_main, Criterion};
|
||||
use tfhe_csprng::seeders::{RdseedSeeder, Seeder};
|
||||
|
||||
// The number of bytes to generate during one benchmark iteration.
|
||||
const N_GEN: usize = 1_000_000;
|
||||
@@ -3,30 +3,30 @@
|
||||
//! optional argument `--bytes_total`. For testing purpose.
|
||||
use clap::{value_parser, Arg, Command};
|
||||
#[cfg(feature = "generator_x86_64_aesni")]
|
||||
use concrete_csprng::generators::AesniRandomGenerator as ActivatedRandomGenerator;
|
||||
use tfhe_csprng::generators::AesniRandomGenerator as ActivatedRandomGenerator;
|
||||
#[cfg(feature = "generator_aarch64_aes")]
|
||||
use concrete_csprng::generators::NeonAesRandomGenerator as ActivatedRandomGenerator;
|
||||
use concrete_csprng::generators::RandomGenerator;
|
||||
use tfhe_csprng::generators::NeonAesRandomGenerator as ActivatedRandomGenerator;
|
||||
use tfhe_csprng::generators::RandomGenerator;
|
||||
#[cfg(all(
|
||||
not(feature = "generator_x86_64_aesni"),
|
||||
not(feature = "generator_aarch64_aes"),
|
||||
feature = "generator_fallback"
|
||||
))]
|
||||
use concrete_csprng::generators::SoftwareRandomGenerator as ActivatedRandomGenerator;
|
||||
use tfhe_csprng::generators::SoftwareRandomGenerator as ActivatedRandomGenerator;
|
||||
|
||||
use std::io::prelude::*;
|
||||
use std::io::{stdout, StdoutLock};
|
||||
#[cfg(target_os = "macos")]
|
||||
use concrete_csprng::seeders::AppleSecureEnclaveSeeder as ActivatedSeeder;
|
||||
use tfhe_csprng::seeders::AppleSecureEnclaveSeeder as ActivatedSeeder;
|
||||
#[cfg(all(not(target_os = "macos"), feature = "seeder_x86_64_rdseed"))]
|
||||
use concrete_csprng::seeders::RdseedSeeder as ActivatedSeeder;
|
||||
use concrete_csprng::seeders::Seeder;
|
||||
use tfhe_csprng::seeders::RdseedSeeder as ActivatedSeeder;
|
||||
use tfhe_csprng::seeders::Seeder;
|
||||
#[cfg(all(
|
||||
not(target_os = "macos"),
|
||||
not(feature = "seeder_x86_64_rdseed"),
|
||||
feature = "seeder_unix"
|
||||
))]
|
||||
use concrete_csprng::seeders::UnixSeeder as ActivatedSeeder;
|
||||
use std::io::prelude::*;
|
||||
use std::io::{stdout, StdoutLock};
|
||||
use tfhe_csprng::seeders::UnixSeeder as ActivatedSeeder;
|
||||
|
||||
fn write_bytes(
|
||||
buffer: &mut [u8],
|
||||
@@ -1,7 +1,7 @@
|
||||
#![deny(rustdoc::broken_intra_doc_links)]
|
||||
//! Cryptographically secure pseudo random number generator.
|
||||
//!
|
||||
//! Welcome to the `concrete-csprng` documentation.
|
||||
//! Welcome to the `tfhe-csprng` documentation.
|
||||
//!
|
||||
//! This crate provides a fast cryptographically secure pseudo-random number generator, suited to
|
||||
//! work in a multithreaded setting.
|
||||
@@ -21,9 +21,9 @@ impl UnixSeeder {
|
||||
/// The attack hypotheses are as follow:
|
||||
/// - `/dev/random` output can be predicted by a process running on the machine by just
|
||||
/// observing various states of the machine
|
||||
/// - The attacker cannot read data from the process where `concrete-csprng` is running
|
||||
/// - The attacker cannot read data from the process where `tfhe-csprng` is running
|
||||
///
|
||||
/// Using a secret in `concrete-csprng` allows to generate values that the attacker cannot
|
||||
/// Using a secret in `tfhe-csprng` allows to generate values that the attacker cannot
|
||||
/// predict, making this seeder secure on systems were `/dev/random` outputs can be
|
||||
/// predicted.
|
||||
pub fn new(secret: u128) -> UnixSeeder {
|
||||
@@ -54,7 +54,7 @@ tfhe-backward-compat-data = { git = "https://github.com/zama-ai/tfhe-backward-co
|
||||
cbindgen = { version = "0.26.0", optional = true }
|
||||
|
||||
[dependencies]
|
||||
concrete-csprng = { version = "0.4.1", path = "../concrete-csprng", features = [
|
||||
tfhe-csprng = { version = "0.4.1", path = "../tfhe-csprng", features = [
|
||||
"generator_fallback",
|
||||
"parallel",
|
||||
] }
|
||||
@@ -133,17 +133,17 @@ nightly-avx512 = ["tfhe-fft/nightly", "tfhe-ntt/nightly", "pulp/nightly"]
|
||||
|
||||
# Enable the x86_64 specific accelerated implementation of the random generator for the default
|
||||
# backend
|
||||
generator_x86_64_aesni = ["concrete-csprng/generator_x86_64_aesni"]
|
||||
generator_x86_64_aesni = ["tfhe-csprng/generator_x86_64_aesni"]
|
||||
|
||||
# Enable the aarch64 specific accelerated implementation of the random generator for the default
|
||||
# backend
|
||||
generator_aarch64_aes = ["concrete-csprng/generator_aarch64_aes"]
|
||||
generator_aarch64_aes = ["tfhe-csprng/generator_aarch64_aes"]
|
||||
|
||||
# Private features
|
||||
__profiling = []
|
||||
|
||||
seeder_unix = ["concrete-csprng/seeder_unix"]
|
||||
seeder_x86_64_rdseed = ["concrete-csprng/seeder_x86_64_rdseed"]
|
||||
seeder_unix = ["tfhe-csprng/seeder_unix"]
|
||||
seeder_x86_64_rdseed = ["tfhe-csprng/seeder_x86_64_rdseed"]
|
||||
|
||||
# These target_arch features enable a set of public features for tfhe if users want a known
|
||||
# good/working configuration for tfhe.
|
||||
|
||||
@@ -2,12 +2,12 @@ use crate::utilities::{
|
||||
throughput_num_threads, write_to_json, BenchmarkType, OperatorType, ParamsAndNumBlocksIter,
|
||||
BENCH_TYPE,
|
||||
};
|
||||
use concrete_csprng::seeders::Seed;
|
||||
use criterion::{black_box, Criterion, Throughput};
|
||||
use rayon::prelude::*;
|
||||
use tfhe::integer::keycache::KEY_CACHE;
|
||||
use tfhe::integer::IntegerKeyKind;
|
||||
use tfhe::keycache::NamedParam;
|
||||
use tfhe_csprng::seeders::Seed;
|
||||
|
||||
pub fn unsigned_oprf(c: &mut Criterion) {
|
||||
let bench_name = "integer::unsigned_oprf";
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
use concrete_csprng::seeders::Seeder;
|
||||
use criterion::*;
|
||||
use tfhe::core_crypto::commons::generators::DeterministicSeeder;
|
||||
use tfhe::core_crypto::prelude::{
|
||||
@@ -8,6 +7,7 @@ use tfhe::core_crypto::prelude::{
|
||||
};
|
||||
use tfhe::core_crypto::seeders::new_seeder;
|
||||
use tfhe::shortint::prelude::*;
|
||||
use tfhe_csprng::seeders::Seeder;
|
||||
|
||||
fn criterion_bench(c: &mut Criterion) {
|
||||
let parameters = PARAM_MESSAGE_2_CARRY_2_KS_PBS;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use concrete_csprng::seeders::Seed;
|
||||
use criterion::{black_box, criterion_group, Criterion};
|
||||
use tfhe::keycache::NamedParam;
|
||||
use tfhe::shortint::keycache::KEY_CACHE;
|
||||
use tfhe::shortint::parameters::*;
|
||||
use tfhe_csprng::seeders::Seed;
|
||||
|
||||
fn oprf(c: &mut Criterion) {
|
||||
let bench_name = "shortint-oprf";
|
||||
|
||||
@@ -9,8 +9,8 @@ use crate::core_crypto::commons::numeric::UnsignedInteger;
|
||||
use crate::core_crypto::commons::parameters::{
|
||||
CiphertextModulus, EncryptionMaskByteCount, EncryptionMaskSampleCount,
|
||||
};
|
||||
use concrete_csprng::generators::ForkError;
|
||||
use rayon::prelude::*;
|
||||
use tfhe_csprng::generators::ForkError;
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct MaskRandomGeneratorForkConfig {
|
||||
|
||||
@@ -14,10 +14,10 @@ use crate::core_crypto::commons::parameters::{
|
||||
CiphertextModulus, EncryptionMaskByteCount, EncryptionMaskSampleCount,
|
||||
EncryptionNoiseByteCount, EncryptionNoiseSampleCount,
|
||||
};
|
||||
use concrete_csprng::generators::ForkError;
|
||||
use mask_random_generator::{MaskRandomGenerator, MaskRandomGeneratorForkConfig};
|
||||
use noise_random_generator::{NoiseRandomGenerator, NoiseRandomGeneratorForkConfig};
|
||||
use rayon::prelude::*;
|
||||
use tfhe_csprng::generators::ForkError;
|
||||
|
||||
pub const PER_SAMPLE_TARGET_FAILURE_PROBABILITY_LOG2: f64 = -128.;
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ use crate::core_crypto::commons::numeric::UnsignedInteger;
|
||||
use crate::core_crypto::commons::parameters::{
|
||||
CiphertextModulus, EncryptionNoiseByteCount, EncryptionNoiseSampleCount,
|
||||
};
|
||||
use concrete_csprng::generators::ForkError;
|
||||
use rayon::prelude::*;
|
||||
use tfhe_csprng::generators::ForkError;
|
||||
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct NoiseRandomGeneratorForkConfig {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! Module containing various APIs wrapping `concrete-csprng` generators for specialized use in
|
||||
//! Module containing various APIs wrapping `tfhe-csprng` generators for specialized use in
|
||||
//! [`TFHE-rs`](`crate`).
|
||||
|
||||
mod encryption;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#[cfg(feature = "generator_x86_64_aesni")]
|
||||
use concrete_csprng::generators::AesniRandomGenerator;
|
||||
use tfhe_csprng::generators::AesniRandomGenerator;
|
||||
#[cfg(feature = "generator_aarch64_aes")]
|
||||
use concrete_csprng::generators::NeonAesRandomGenerator;
|
||||
use tfhe_csprng::generators::NeonAesRandomGenerator;
|
||||
#[cfg(all(
|
||||
not(feature = "generator_x86_64_aesni"),
|
||||
not(feature = "generator_aarch64_aes")
|
||||
))]
|
||||
use concrete_csprng::generators::SoftwareRandomGenerator;
|
||||
use tfhe_csprng::generators::SoftwareRandomGenerator;
|
||||
|
||||
#[cfg(feature = "generator_x86_64_aesni")]
|
||||
pub type ActivatedRandomGenerator = AesniRandomGenerator;
|
||||
|
||||
@@ -7,24 +7,24 @@ use crate::core_crypto::commons::math::random::{
|
||||
use crate::core_crypto::commons::math::torus::{UnsignedInteger, UnsignedTorus};
|
||||
use crate::core_crypto::commons::numeric::{CastInto, FloatingPoint};
|
||||
use crate::core_crypto::commons::parameters::CiphertextModulus;
|
||||
use concrete_csprng::generators::{BytesPerChild, ChildrenCount, ForkError};
|
||||
use rayon::prelude::*;
|
||||
use tfhe_csprng::generators::{BytesPerChild, ChildrenCount, ForkError};
|
||||
|
||||
pub use concrete_csprng::generators::{
|
||||
pub use tfhe_csprng::generators::{
|
||||
ParallelRandomGenerator as ParallelByteRandomGenerator, RandomGenerator as ByteRandomGenerator,
|
||||
};
|
||||
pub use concrete_csprng::seeders::{Seed, Seeder};
|
||||
pub use tfhe_csprng::seeders::{Seed, Seeder};
|
||||
|
||||
/// Module to proxy the serialization for `concrete-csprng::Seed` to avoid adding serde as a
|
||||
/// dependency to `concrete-csprng`
|
||||
/// Module to proxy the serialization for `tfhe-csprng::Seed` to avoid adding serde as a
|
||||
/// dependency to `tfhe-csprng`
|
||||
pub mod serialization_proxy {
|
||||
pub(crate) use concrete_csprng::seeders::Seed;
|
||||
pub(crate) use serde::{Deserialize, Serialize};
|
||||
pub(crate) use tfhe_csprng::seeders::Seed;
|
||||
|
||||
// See https://serde.rs/remote-derive.html
|
||||
// Serde calls this the definition of the remote type. It is just a copy of the remote data
|
||||
// structure. The `remote` attribute gives the path to the actual type we intend to derive code
|
||||
// for. This avoids having to introduce serde in concrete-csprng
|
||||
// for. This avoids having to introduce serde in tfhe-csprng
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[serde(remote = "Seed")]
|
||||
pub(crate) struct SeedSerdeDef(pub u128);
|
||||
@@ -86,9 +86,9 @@ impl From<Seed> for CompressionSeed {
|
||||
/// used by the different threads safely:
|
||||
///
|
||||
/// ```rust
|
||||
/// use concrete_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use concrete_csprng::seeders::Seed;
|
||||
/// use tfhe::core_crypto::commons::math::random::RandomGenerator;
|
||||
/// use tfhe_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use tfhe_csprng::seeders::Seed;
|
||||
/// let mut generator = RandomGenerator::<SoftwareRandomGenerator>::new(Seed(0));
|
||||
/// assert_eq!(generator.remaining_bytes(), None); // The generator is unbounded.
|
||||
/// let children = generator
|
||||
@@ -117,9 +117,9 @@ impl<G: ByteRandomGenerator> RandomGenerator<G> {
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use concrete_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use concrete_csprng::seeders::Seed;
|
||||
/// use tfhe::core_crypto::commons::math::random::RandomGenerator;
|
||||
/// use tfhe_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use tfhe_csprng::seeders::Seed;
|
||||
/// let generator = RandomGenerator::<SoftwareRandomGenerator>::new(Seed(0));
|
||||
/// ```
|
||||
pub fn new(seed: Seed) -> Self {
|
||||
@@ -131,9 +131,9 @@ impl<G: ByteRandomGenerator> RandomGenerator<G> {
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use concrete_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use concrete_csprng::seeders::Seed;
|
||||
/// use tfhe::core_crypto::commons::math::random::RandomGenerator;
|
||||
/// use tfhe_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use tfhe_csprng::seeders::Seed;
|
||||
/// let mut generator = RandomGenerator::<SoftwareRandomGenerator>::new(Seed(0));
|
||||
/// assert_eq!(generator.remaining_bytes(), None);
|
||||
/// let generator = generator.try_fork(1, 50).unwrap().next().unwrap();
|
||||
@@ -150,9 +150,9 @@ impl<G: ByteRandomGenerator> RandomGenerator<G> {
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use concrete_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use concrete_csprng::seeders::Seed;
|
||||
/// use tfhe::core_crypto::commons::math::random::RandomGenerator;
|
||||
/// use tfhe_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use tfhe_csprng::seeders::Seed;
|
||||
/// let mut generator = RandomGenerator::<SoftwareRandomGenerator>::new(Seed(0));
|
||||
/// let children = generator.try_fork(5, 50).unwrap().collect::<Vec<_>>();
|
||||
/// ```
|
||||
@@ -171,9 +171,9 @@ impl<G: ByteRandomGenerator> RandomGenerator<G> {
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use concrete_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use concrete_csprng::seeders::Seed;
|
||||
/// use tfhe::core_crypto::commons::math::random::{Gaussian, RandomGenerator, Uniform};
|
||||
/// use tfhe_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use tfhe_csprng::seeders::Seed;
|
||||
///
|
||||
/// let mut generator = RandomGenerator::<SoftwareRandomGenerator>::new(Seed(0));
|
||||
///
|
||||
@@ -198,10 +198,10 @@ impl<G: ByteRandomGenerator> RandomGenerator<G> {
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use concrete_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use concrete_csprng::seeders::Seed;
|
||||
/// use tfhe::core_crypto::commons::ciphertext_modulus::CiphertextModulus;
|
||||
/// use tfhe::core_crypto::commons::math::random::{Gaussian, RandomGenerator, Uniform};
|
||||
/// use tfhe_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use tfhe_csprng::seeders::Seed;
|
||||
///
|
||||
/// let mut generator = RandomGenerator::<SoftwareRandomGenerator>::new(Seed(0));
|
||||
///
|
||||
@@ -241,9 +241,9 @@ impl<G: ByteRandomGenerator> RandomGenerator<G> {
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use concrete_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use concrete_csprng::seeders::Seed;
|
||||
/// use tfhe::core_crypto::commons::math::random::{Gaussian, RandomGenerator, Uniform};
|
||||
/// use tfhe_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use tfhe_csprng::seeders::Seed;
|
||||
///
|
||||
/// let mut generator = RandomGenerator::<SoftwareRandomGenerator>::new(Seed(0));
|
||||
///
|
||||
@@ -277,10 +277,10 @@ impl<G: ByteRandomGenerator> RandomGenerator<G> {
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use concrete_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use concrete_csprng::seeders::Seed;
|
||||
/// use tfhe::core_crypto::commons::ciphertext_modulus::CiphertextModulus;
|
||||
/// use tfhe::core_crypto::commons::math::random::{Gaussian, RandomGenerator, Uniform};
|
||||
/// use tfhe_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use tfhe_csprng::seeders::Seed;
|
||||
///
|
||||
/// let mut generator = RandomGenerator::<SoftwareRandomGenerator>::new(Seed(0));
|
||||
///
|
||||
@@ -328,9 +328,9 @@ impl<G: ByteRandomGenerator> RandomGenerator<G> {
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use concrete_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use concrete_csprng::seeders::Seed;
|
||||
/// use tfhe::core_crypto::commons::math::random::{Gaussian, RandomGenerator, Uniform};
|
||||
/// use tfhe_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use tfhe_csprng::seeders::Seed;
|
||||
///
|
||||
/// let mut generator = RandomGenerator::<SoftwareRandomGenerator>::new(Seed(0));
|
||||
///
|
||||
@@ -365,10 +365,10 @@ impl<G: ByteRandomGenerator> RandomGenerator<G> {
|
||||
///
|
||||
///
|
||||
/// ```rust
|
||||
/// use concrete_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use concrete_csprng::seeders::Seed;
|
||||
/// use tfhe::core_crypto::commons::ciphertext_modulus::CiphertextModulus;
|
||||
/// use tfhe::core_crypto::commons::math::random::{Gaussian, RandomGenerator, Uniform};
|
||||
/// use tfhe_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use tfhe_csprng::seeders::Seed;
|
||||
///
|
||||
/// let mut generator = RandomGenerator::<SoftwareRandomGenerator>::new(Seed(0));
|
||||
///
|
||||
@@ -424,9 +424,9 @@ impl<G: ByteRandomGenerator> RandomGenerator<G> {
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use concrete_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use concrete_csprng::seeders::Seed;
|
||||
/// use tfhe::core_crypto::commons::math::random::RandomGenerator;
|
||||
/// use tfhe_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use tfhe_csprng::seeders::Seed;
|
||||
/// let mut generator = RandomGenerator::<SoftwareRandomGenerator>::new(Seed(0));
|
||||
///
|
||||
/// let random = generator.random_uniform::<u8>();
|
||||
@@ -454,10 +454,10 @@ impl<G: ByteRandomGenerator> RandomGenerator<G> {
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use concrete_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use concrete_csprng::seeders::Seed;
|
||||
/// use tfhe::core_crypto::commons::ciphertext_modulus::CiphertextModulus;
|
||||
/// use tfhe::core_crypto::commons::math::random::RandomGenerator;
|
||||
/// use tfhe_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use tfhe_csprng::seeders::Seed;
|
||||
/// let mut generator = RandomGenerator::<SoftwareRandomGenerator>::new(Seed(0));
|
||||
///
|
||||
/// let random =
|
||||
@@ -494,9 +494,9 @@ impl<G: ByteRandomGenerator> RandomGenerator<G> {
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use concrete_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use concrete_csprng::seeders::Seed;
|
||||
/// use tfhe::core_crypto::commons::math::random::RandomGenerator;
|
||||
/// use tfhe_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use tfhe_csprng::seeders::Seed;
|
||||
/// let mut generator = RandomGenerator::<SoftwareRandomGenerator>::new(Seed(0));
|
||||
/// let mut vec = vec![0u32; 1000];
|
||||
/// generator.fill_slice_with_random_uniform(&mut vec);
|
||||
@@ -514,10 +514,10 @@ impl<G: ByteRandomGenerator> RandomGenerator<G> {
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use concrete_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use concrete_csprng::seeders::Seed;
|
||||
/// use tfhe::core_crypto::commons::math::random::RandomGenerator;
|
||||
/// use tfhe::core_crypto::commons::parameters::CiphertextModulus;
|
||||
/// use tfhe_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use tfhe_csprng::seeders::Seed;
|
||||
/// let mut generator = RandomGenerator::<SoftwareRandomGenerator>::new(Seed(0));
|
||||
/// let mut vec = vec![0u32; 1000];
|
||||
/// generator.fill_slice_with_random_uniform_custom_mod(
|
||||
@@ -548,9 +548,9 @@ impl<G: ByteRandomGenerator> RandomGenerator<G> {
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use concrete_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use concrete_csprng::seeders::Seed;
|
||||
/// use tfhe::core_crypto::commons::math::random::RandomGenerator;
|
||||
/// use tfhe_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use tfhe_csprng::seeders::Seed;
|
||||
/// let mut generator = RandomGenerator::<SoftwareRandomGenerator>::new(Seed(0));
|
||||
/// let random: u32 = generator.random_uniform_binary();
|
||||
/// ```
|
||||
@@ -566,9 +566,9 @@ impl<G: ByteRandomGenerator> RandomGenerator<G> {
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use concrete_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use concrete_csprng::seeders::Seed;
|
||||
/// use tfhe::core_crypto::commons::math::random::RandomGenerator;
|
||||
/// use tfhe_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use tfhe_csprng::seeders::Seed;
|
||||
/// let mut generator = RandomGenerator::<SoftwareRandomGenerator>::new(Seed(0));
|
||||
/// let mut vec = vec![0u32; 1000];
|
||||
/// generator.fill_slice_with_random_uniform_binary(&mut vec);
|
||||
@@ -586,9 +586,9 @@ impl<G: ByteRandomGenerator> RandomGenerator<G> {
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use concrete_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use concrete_csprng::seeders::Seed;
|
||||
/// use tfhe::core_crypto::commons::math::random::RandomGenerator;
|
||||
/// use tfhe_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use tfhe_csprng::seeders::Seed;
|
||||
/// let mut generator = RandomGenerator::<SoftwareRandomGenerator>::new(Seed(0));
|
||||
/// let random: u32 = generator.random_uniform_ternary();
|
||||
/// ```
|
||||
@@ -605,9 +605,9 @@ impl<G: ByteRandomGenerator> RandomGenerator<G> {
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use concrete_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use concrete_csprng::seeders::Seed;
|
||||
/// use tfhe::core_crypto::commons::math::random::RandomGenerator;
|
||||
/// use tfhe_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use tfhe_csprng::seeders::Seed;
|
||||
/// let mut generator = RandomGenerator::<SoftwareRandomGenerator>::new(Seed(0));
|
||||
/// // for f32
|
||||
/// let (g1, g2): (f32, f32) = generator.random_gaussian(0_f32, 1_f32);
|
||||
@@ -633,9 +633,9 @@ impl<G: ByteRandomGenerator> RandomGenerator<G> {
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use concrete_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use concrete_csprng::seeders::Seed;
|
||||
/// use tfhe::core_crypto::commons::math::random::RandomGenerator;
|
||||
/// use tfhe_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use tfhe_csprng::seeders::Seed;
|
||||
/// let mut generator = RandomGenerator::<SoftwareRandomGenerator>::new(Seed(0));
|
||||
/// let mut vec = vec![0f32; 1000];
|
||||
/// generator.fill_slice_with_random_gaussian(&mut vec, 0., 1.);
|
||||
@@ -666,10 +666,10 @@ impl<G: ByteRandomGenerator> RandomGenerator<G> {
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use concrete_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use concrete_csprng::seeders::Seed;
|
||||
/// use tfhe::core_crypto::commons::math::random::RandomGenerator;
|
||||
/// use tfhe::core_crypto::commons::parameters::CiphertextModulus;
|
||||
/// use tfhe_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use tfhe_csprng::seeders::Seed;
|
||||
/// let mut generator = RandomGenerator::<SoftwareRandomGenerator>::new(Seed(0));
|
||||
/// let mut vec = vec![0u64; 1000];
|
||||
/// generator.fill_slice_with_random_gaussian_custom_mod(
|
||||
@@ -717,9 +717,9 @@ impl<G: ByteRandomGenerator> RandomGenerator<G> {
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use concrete_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use concrete_csprng::seeders::Seed;
|
||||
/// use tfhe::core_crypto::commons::math::random::RandomGenerator;
|
||||
/// use tfhe_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use tfhe_csprng::seeders::Seed;
|
||||
/// let mut generator = RandomGenerator::<SoftwareRandomGenerator>::new(Seed(0));
|
||||
/// let mut vec = vec![0u32; 1000];
|
||||
/// generator.unsigned_torus_slice_wrapping_add_random_gaussian_assign(&mut vec, 0., 1.);
|
||||
@@ -751,10 +751,10 @@ impl<G: ByteRandomGenerator> RandomGenerator<G> {
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use concrete_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use concrete_csprng::seeders::Seed;
|
||||
/// use tfhe::core_crypto::commons::math::random::RandomGenerator;
|
||||
/// use tfhe::core_crypto::commons::parameters::CiphertextModulus;
|
||||
/// use tfhe_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use tfhe_csprng::seeders::Seed;
|
||||
/// let mut generator = RandomGenerator::<SoftwareRandomGenerator>::new(Seed(0));
|
||||
/// let mut vec = vec![0u32; 1000];
|
||||
/// generator.unsigned_torus_slice_wrapping_add_random_gaussian_custom_mod_assign(
|
||||
@@ -808,9 +808,9 @@ impl<G: ParallelByteRandomGenerator> RandomGenerator<G> {
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use concrete_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use concrete_csprng::seeders::Seed;
|
||||
/// use tfhe::core_crypto::commons::math::random::RandomGenerator;
|
||||
/// use tfhe_csprng::generators::SoftwareRandomGenerator;
|
||||
/// use tfhe_csprng::seeders::Seed;
|
||||
/// let mut generator = RandomGenerator::<SoftwareRandomGenerator>::new(Seed(0));
|
||||
/// let children = generator.try_fork(5, 50).unwrap().collect::<Vec<_>>();
|
||||
/// ```
|
||||
|
||||
@@ -43,7 +43,7 @@ pub mod test_tools {
|
||||
LweDimension, PlaintextCount, PolynomialSize,
|
||||
};
|
||||
use crate::core_crypto::commons::traits::*;
|
||||
use concrete_csprng::seeders::Seed;
|
||||
use tfhe_csprng::seeders::Seed;
|
||||
|
||||
pub fn variance(samples: &[f64]) -> Variance {
|
||||
let num_samples = samples.len();
|
||||
|
||||
@@ -15,7 +15,7 @@ use crate::core_crypto::prelude::*;
|
||||
/// use tfhe::core_crypto::fft_impl::common::modulus_switch;
|
||||
/// use tfhe::core_crypto::prelude::compressed_modulus_switched_glwe_ciphertext::CompressedModulusSwitchedGlweCiphertext;
|
||||
/// use tfhe::core_crypto::prelude::*;
|
||||
/// use concrete_csprng::seeders::Seed;
|
||||
/// use tfhe_csprng::seeders::Seed;
|
||||
///
|
||||
/// let log_modulus = 12;
|
||||
///
|
||||
|
||||
@@ -13,7 +13,7 @@ use crate::core_crypto::prelude::*;
|
||||
/// ciphertext
|
||||
///
|
||||
/// ```rust
|
||||
/// use concrete_csprng::seeders::Seed;
|
||||
/// use tfhe_csprng::seeders::Seed;
|
||||
/// use tfhe::core_crypto::fft_impl::common::modulus_switch;
|
||||
/// use tfhe::core_crypto::prelude::*;
|
||||
/// use tfhe::core_crypto::prelude::compressed_modulus_switched_lwe_ciphertext::CompressedModulusSwitchedLweCiphertext;
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
|
||||
pub use crate::core_crypto::commons::math::random::Seeder;
|
||||
#[cfg(all(target_os = "macos", not(feature = "__wasm_api")))]
|
||||
pub use concrete_csprng::seeders::AppleSecureEnclaveSeeder;
|
||||
pub use tfhe_csprng::seeders::AppleSecureEnclaveSeeder;
|
||||
#[cfg(feature = "seeder_x86_64_rdseed")]
|
||||
pub use concrete_csprng::seeders::RdseedSeeder;
|
||||
pub use tfhe_csprng::seeders::RdseedSeeder;
|
||||
#[cfg(feature = "seeder_unix")]
|
||||
pub use concrete_csprng::seeders::UnixSeeder;
|
||||
pub use tfhe_csprng::seeders::UnixSeeder;
|
||||
|
||||
#[cfg(feature = "__wasm_api")]
|
||||
mod wasm_seeder {
|
||||
|
||||
@@ -2,7 +2,7 @@ use super::FheBool;
|
||||
use crate::high_level_api::global_state;
|
||||
use crate::high_level_api::keys::InternalServerKey;
|
||||
use crate::integer::BooleanBlock;
|
||||
use concrete_csprng::seeders::Seed;
|
||||
use tfhe_csprng::seeders::Seed;
|
||||
|
||||
impl FheBool {
|
||||
/// Generates an encrypted boolean
|
||||
|
||||
@@ -11,7 +11,7 @@ use crate::named::Named;
|
||||
use crate::prelude::Tagged;
|
||||
use crate::shortint::MessageModulus;
|
||||
use crate::Tag;
|
||||
use concrete_csprng::seeders::Seed;
|
||||
use tfhe_csprng::seeders::Seed;
|
||||
use tfhe_versionable::Versionize;
|
||||
|
||||
/// Key of the client
|
||||
|
||||
@@ -15,8 +15,8 @@ use crate::shortint::parameters::{
|
||||
};
|
||||
use crate::shortint::{EncryptionKeyChoice, MessageModulus, PBSParameters};
|
||||
use crate::{Config, Error};
|
||||
use concrete_csprng::seeders::Seed;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tfhe_csprng::seeders::Seed;
|
||||
use tfhe_versionable::Versionize;
|
||||
|
||||
// Clippy complained that fields end in _parameters, :roll_eyes:
|
||||
|
||||
@@ -3,7 +3,7 @@ use crate::core_crypto::commons::generators::DeterministicSeeder;
|
||||
use crate::core_crypto::prelude::ActivatedRandomGenerator;
|
||||
use rayon::iter::{IndexedParallelIterator, IntoParallelIterator, ParallelIterator};
|
||||
|
||||
pub use concrete_csprng::seeders::{Seed, Seeder};
|
||||
pub use tfhe_csprng::seeders::{Seed, Seeder};
|
||||
|
||||
impl ServerKey {
|
||||
/// Generates an encrypted `num_block` blocks unsigned integer
|
||||
@@ -293,7 +293,7 @@ impl ServerKey {
|
||||
pub(crate) mod test {
|
||||
|
||||
use crate::shortint::oprf::test::test_uniformity;
|
||||
use concrete_csprng::seeders::Seed;
|
||||
use tfhe_csprng::seeders::Seed;
|
||||
|
||||
#[test]
|
||||
fn oprf_test_uniformity_ci_run_filter() {
|
||||
|
||||
@@ -8,7 +8,7 @@ use crate::shortint::engine::ShortintEngine;
|
||||
use crate::shortint::parameters::NoiseLevel;
|
||||
use crate::shortint::server_key::{apply_programmable_bootstrap, LookupTableOwned};
|
||||
use crate::shortint::{PBSOrder, ServerKey};
|
||||
use concrete_csprng::seeders::Seed;
|
||||
use tfhe_csprng::seeders::Seed;
|
||||
|
||||
pub fn sha3_hash(values: &mut [u64], seed: Seed) {
|
||||
use sha3::digest::{ExtendableOutput, Update, XofReader};
|
||||
@@ -166,11 +166,11 @@ pub(crate) mod test {
|
||||
};
|
||||
use crate::shortint::engine::ShortintEngine;
|
||||
use crate::shortint::{ClientKey, ServerKey};
|
||||
use concrete_csprng::seeders::Seed;
|
||||
use itertools::Itertools;
|
||||
use rayon::prelude::*;
|
||||
use statrs::distribution::ContinuousCDF;
|
||||
use std::collections::HashMap;
|
||||
use tfhe_csprng::seeders::Seed;
|
||||
|
||||
fn square(a: f64) -> f64 {
|
||||
a * a
|
||||
|
||||
Reference in New Issue
Block a user