Skip to content

Commit

Permalink
style(global): fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
mayeul-zama committed Sep 25, 2023
1 parent 4045a3b commit 6c5e5e4
Show file tree
Hide file tree
Showing 64 changed files with 203 additions and 203 deletions.
2 changes: 1 addition & 1 deletion apps/trivium/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ fn main() {

# FHE byte Trivium implementation

The same objects have also been implemented to stream bytes insead of booleans. They can be constructed and used in the same way via the functions `TriviumStreamByte::<u8>::new` and
The same objects have also been implemented to stream bytes instead of booleans. They can be constructed and used in the same way via the functions `TriviumStreamByte::<u8>::new` and
`TriviumStreamByte::<FheUint8>::new` with the same arguments as before. The `FheUint8` version is significantly slower than the `FheBool` version, because not running
with the same cryptographic parameters. Its interest lie in its trans-ciphering capabilities: `TriviumStreamByte<FheUint8>` implements the trait `TransCiphering`,
meaning it implements the functions `trans_encrypt_64`. This function takes as input a `FheUint64` and outputs a `FheUint64`, the output being
Expand Down
6 changes: 3 additions & 3 deletions apps/trivium/src/kreyvium/kreyvium.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! This module implements the Kreyvium stream cipher, using booleans or FheBool
//! for the representaion of the inner bits.
//! for the representation of the inner bits.

use crate::static_deque::StaticDeque;

Expand Down Expand Up @@ -35,7 +35,7 @@ pub struct KreyviumStream<T> {
}

impl KreyviumStream<bool> {
/// Contructor for `KreyviumStream<bool>`: arguments are the secret key and the input vector.
/// Constructor for `KreyviumStream<bool>`: arguments are the secret key and the input vector.
/// Outputs a KreyviumStream object already initialized (1152 steps have been run before
/// returning)
pub fn new(mut key: [bool; 128], mut iv: [bool; 128]) -> KreyviumStream<bool> {
Expand Down Expand Up @@ -118,7 +118,7 @@ where
T: KreyviumBoolInput<T> + std::marker::Send + std::marker::Sync,
for<'a> &'a T: KreyviumBoolInput<T>,
{
/// Internal generic contructor: arguments are already prepared registers, and an optional FHE
/// Internal generic constructor: arguments are already prepared registers, and an optional FHE
/// server key
fn new_from_registers(
a_register: [T; 93],
Expand Down
6 changes: 3 additions & 3 deletions apps/trivium/src/kreyvium/kreyvium_byte.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! This module implements the Kreyvium stream cipher, using u8 or FheUint8
//! for the representaion of the inner bits.
//! for the representation of the inner bits.

use crate::static_deque::{StaticByteDeque, StaticByteDequeInput};

Expand Down Expand Up @@ -43,7 +43,7 @@ pub struct KreyviumStreamByte<T> {
}

impl KreyviumStreamByte<u8> {
/// Contructor for `KreyviumStreamByte<u8>`: arguments are the secret key and the input vector.
/// Constructor for `KreyviumStreamByte<u8>`: arguments are the secret key and the input vector.
/// Outputs a KreyviumStream object already initialized (1152 steps have been run before
/// returning)
pub fn new(key_bytes: [u8; 16], iv_bytes: [u8; 16]) -> KreyviumStreamByte<u8> {
Expand Down Expand Up @@ -146,7 +146,7 @@ where
T: KreyviumByteInput<T> + Send,
for<'a> &'a T: KreyviumByteInput<T>,
{
/// Internal generic contructor: arguments are already prepared registers, and an optional FHE
/// Internal generic constructor: arguments are already prepared registers, and an optional FHE
/// server key
fn new_from_registers(
a_register: [T; 12],
Expand Down
2 changes: 1 addition & 1 deletion apps/trivium/src/kreyvium/kreyvium_shortint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub struct KreyviumStreamShortint {
}

impl KreyviumStreamShortint {
/// Contructor for KreyviumStreamShortint: arguments are the secret key and the input vector,
/// Constructor for KreyviumStreamShortint: arguments are the secret key and the input vector,
/// and a ServerKey reference. Outputs a KreyviumStream object already initialized (1152
/// steps have been run before returning)
pub fn new(
Expand Down
2 changes: 1 addition & 1 deletion apps/trivium/src/static_deque/static_byte_deque.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! This module implements the StaticByteDeque struct: a deque of bytes. The idea
//! is that this is a wrapper around StaticDeque, but StaticByteDeque has an additional
//! functionnality: it can construct the "intermediate" bytes, made of parts of other bytes.
//! functionality: it can construct the "intermediate" bytes, made of parts of other bytes.
//! This is pretending to store bits, and allows accessing bits in chunks of 8 consecutive.

use crate::static_deque::StaticDeque;
Expand Down
2 changes: 1 addition & 1 deletion apps/trivium/src/static_deque/static_deque.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use core::ops::{Index, IndexMut};

/// StaticDeque: a struct implementing a deque whose size is known at compile time.
/// It has 2 members: the static array conatining the data (never empty), and a cursor
/// It has 2 members: the static array containing the data (never empty), and a cursor
/// equal to the index of the oldest element (and the next one to be overwritten).
#[derive(Clone)]
pub struct StaticDeque<const N: usize, T> {
Expand Down
6 changes: 3 additions & 3 deletions apps/trivium/src/trivium/trivium_bool.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! This module implements the Trivium stream cipher, using booleans or FheBool
//! for the representaion of the inner bits.
//! for the representation of the inner bits.

use crate::static_deque::StaticDeque;

Expand Down Expand Up @@ -33,7 +33,7 @@ pub struct TriviumStream<T> {
}

impl TriviumStream<bool> {
/// Contructor for `TriviumStream<bool>`: arguments are the secret key and the input vector.
/// Constructor for `TriviumStream<bool>`: arguments are the secret key and the input vector.
/// Outputs a TriviumStream object already initialized (1152 steps have been run before
/// returning)
pub fn new(key: [bool; 80], iv: [bool; 80]) -> TriviumStream<bool> {
Expand Down Expand Up @@ -94,7 +94,7 @@ where
T: TriviumBoolInput<T> + std::marker::Send + std::marker::Sync,
for<'a> &'a T: TriviumBoolInput<T>,
{
/// Internal generic contructor: arguments are already prepared registers, and an optional FHE
/// Internal generic constructor: arguments are already prepared registers, and an optional FHE
/// server key
fn new_from_registers(
a_register: [T; 93],
Expand Down
6 changes: 3 additions & 3 deletions apps/trivium/src/trivium/trivium_byte.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! This module implements the Trivium stream cipher, using u8 or FheUint8
//! for the representaion of the inner bits.
//! for the representation of the inner bits.

use crate::static_deque::{StaticByteDeque, StaticByteDequeInput};

Expand Down Expand Up @@ -41,7 +41,7 @@ pub struct TriviumStreamByte<T> {
}

impl TriviumStreamByte<u8> {
/// Contructor for `TriviumStreamByte<u8>`: arguments are the secret key and the input vector.
/// Constructor for `TriviumStreamByte<u8>`: arguments are the secret key and the input vector.
/// Outputs a TriviumStream object already initialized (1152 steps have been run before
/// returning)
pub fn new(key: [u8; 10], iv: [u8; 10]) -> TriviumStreamByte<u8> {
Expand Down Expand Up @@ -111,7 +111,7 @@ where
T: TriviumByteInput<T> + Send,
for<'a> &'a T: TriviumByteInput<T>,
{
/// Internal generic contructor: arguments are already prepared registers, and an optional FHE
/// Internal generic constructor: arguments are already prepared registers, and an optional FHE
/// server key
fn new_from_registers(
a_register: [T; 12],
Expand Down
6 changes: 3 additions & 3 deletions apps/trivium/src/trivium/trivium_shortint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ pub struct TriviumStreamShortint {
}

impl TriviumStreamShortint {
/// Contructor for TriviumStreamShortint: arguments are the secret key and the input vector, and
/// a ServerKey reference. Outputs a TriviumStream object already initialized (1152 steps
/// have been run before returning)
/// Constructor for TriviumStreamShortint: arguments are the secret key and the input vector,
/// and a ServerKey reference. Outputs a TriviumStream object already initialized (1152
/// steps have been run before returning)
pub fn new(
key: [Ciphertext; 80],
iv: [u64; 80],
Expand Down
4 changes: 2 additions & 2 deletions concrete-csprng/src/generators/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct BytesPerChild(pub usize);
#[derive(Clone, Copy, Debug, PartialOrd, Ord, PartialEq, Eq)]
pub struct ByteCount(pub u128);

/// An error occuring during a generator fork.
/// An error occurring during a generator fork.
#[derive(Debug)]
pub enum ForkError {
ForkTooLarge,
Expand Down Expand Up @@ -145,7 +145,7 @@ pub mod generator_generic_test {

/// Checks that the PRNG roughly generates uniform numbers.
///
/// To do that, we perform an histogram of the occurences of each byte value, over a fixed
/// To do that, we perform an histogram of the occurrences of each byte value, over a fixed
/// number of samples and check that the empirical probabilities of the bins are close to
/// the theoretical probabilities.
pub fn test_roughly_uniform<G: RandomGenerator>() {
Expand Down
4 changes: 2 additions & 2 deletions concrete-csprng/src/seeders/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! When initializing a generator, one needs to provide a [`Seed`], which is then used as key to the
//! AES blockcipher. As a consequence, the quality of the outputs of the generator is directly
//! conditioned by the quality of this seed. This module proposes different mechanisms to deliver
//! seeds that can accomodate varying scenarios.
//! seeds that can accommodate varying scenarios.

/// A seed value, used to initialize a generator.
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
Expand All @@ -15,7 +15,7 @@ pub trait Seeder {
fn seed(&mut self) -> Seed;

/// Check whether the seeder can be used on the current machine. This function may check if some
/// required CPU features are available or if some OS features are availble for example.
/// required CPU features are available or if some OS features are available for example.
fn is_available() -> bool
where
Self: Sized;
Expand Down
12 changes: 6 additions & 6 deletions tfhe/benches/boolean/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub fn write_to_json_boolean<T: Into<CryptoParametersRecord<u32>>>(

// Put all `bench_function` in one place
// so the keygen is only run once per parameters saving time.
fn benchs(c: &mut Criterion, params: BooleanParameters, parameter_name: &str) {
fn benches(c: &mut Criterion, params: BooleanParameters, parameter_name: &str) {
let mut bench_group = c.benchmark_group("gates_benches");

let cks = ClientKey::new(&params);
Expand Down Expand Up @@ -83,29 +83,29 @@ fn benchs(c: &mut Criterion, params: BooleanParameters, parameter_name: &str) {
}

fn bench_default_parameters(c: &mut Criterion) {
benchs(c, DEFAULT_PARAMETERS, "DEFAULT_PARAMETERS");
benches(c, DEFAULT_PARAMETERS, "DEFAULT_PARAMETERS");
}

fn bench_default_parameters_ks_pbs(c: &mut Criterion) {
benchs(c, DEFAULT_PARAMETERS_KS_PBS, "DEFAULT_PARAMETERS_KS_PBS");
benches(c, DEFAULT_PARAMETERS_KS_PBS, "DEFAULT_PARAMETERS_KS_PBS");
}

fn bench_low_prob_parameters(c: &mut Criterion) {
benchs(
benches(
c,
PARAMETERS_ERROR_PROB_2_POW_MINUS_165,
"PARAMETERS_ERROR_PROB_2_POW_MINUS_165",
);
}

fn bench_low_prob_parameters_ks_pbs(c: &mut Criterion) {
benchs(
benches(
c,
PARAMETERS_ERROR_PROB_2_POW_MINUS_165_KS_PBS,
"PARAMETERS_ERROR_PROB_2_POW_MINUS_165_KS_PBS",
);
}

fn bench_tfhe_lib_parameters(c: &mut Criterion) {
benchs(c, TFHE_LIB_PARAMETERS, " TFHE_LIB_PARAMETERS");
benches(c, TFHE_LIB_PARAMETERS, " TFHE_LIB_PARAMETERS");
}
2 changes: 1 addition & 1 deletion tfhe/c_api_tests/test_high_level_custom_integers.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ int uint256_public_key(const ClientKey *client_key,
lhs = expand_output[0];
rhs = expand_output[1];
// We can destroy the compact list
// The expanded ciphertext are independant from it
// The expanded ciphertext are independent from it
compact_fhe_uint256_list_destroy(list);

ok = fhe_uint256_sub(lhs, rhs, &result);
Expand Down
2 changes: 1 addition & 1 deletion tfhe/docs/application_tutorials/regex.md
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ Pattern | Description
`/^abc$/` | Matches with content that equals exactly `abc` (case sensitive)
`/^abc$/i` | Matches with content that equals `abc` (case insensitive)
`/abc/` | Matches with content that contains somewhere `abc`
`/ab?c/` | Matches with content that contains somewhere `abc` or somwhere `ab`
`/ab?c/` | Matches with content that contains somewhere `abc` or somewhere `ab`
`/^ab*c$/` | For example, matches with: `ac`, `abc`, `abbbbc`
`/^[a-c]b\|cd$/` | Matches with: `ab`, `bb`, `cb`, `cd`
`/^[a-c]b\|cd$/i` | Matches with: `ab`, `Ab`, `aB`, ..., `cD`, `CD`
Expand Down
2 changes: 1 addition & 1 deletion tfhe/docs/core_crypto/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ pub fn main() {
println!("Checking result...");
assert_eq!(6, pbs_multiplication_result);
println!(
"Mulitplication via PBS result is correct! Expected 6, got {pbs_multiplication_result}"
"Multiplication via PBS result is correct! Expected 6, got {pbs_multiplication_result}"
);
}
```
2 changes: 1 addition & 1 deletion tfhe/docs/getting_started/security_and_cryptography.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ The figure below illustrates this problem in the case of an addition, where an e

### Programmable BootStrapping (PBS)

The bootstrapping of TFHE has the particularity of being programmable: this means that any function can be homomorphically computed over an encrypted input, while also reducing the noise. These functions are represented by look-up tables. The computation of a PBS is in general either preceded or followed by a keyswitch, which is an operation used to change the encryption key. The output ciphertext is then encrypted with the same key as the input one. To do this, two (public) evaluation keys are required: a boostrapping key and a keyswitching key. These operations are quite complex to describe, more information about these operations (or about TFHE in general) can be found here [TFHE Deep Dive](https://www.zama.ai/post/tfhe-deep-dive-part-1).
The bootstrapping of TFHE has the particularity of being programmable: this means that any function can be homomorphically computed over an encrypted input, while also reducing the noise. These functions are represented by look-up tables. The computation of a PBS is in general either preceded or followed by a keyswitch, which is an operation used to change the encryption key. The output ciphertext is then encrypted with the same key as the input one. To do this, two (public) evaluation keys are required: a bootstrapping key and a keyswitching key. These operations are quite complex to describe, more information about these operations (or about TFHE in general) can be found here [TFHE Deep Dive](https://www.zama.ai/post/tfhe-deep-dive-part-1).


### Carry.
Expand Down
2 changes: 1 addition & 1 deletion tfhe/docs/how_to/compress.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ fn main() {
This example shows how to compress the classical public keys.

{% hint style="warning" %}
It is not currently recommended to use the CompressedPublicKey to encrypt ciphertexts without first decompressing it. In case the resulting PublicKey is too large to fit in memory the encryption with the CompressedPublicKey will be very slow, this is a known problem and will be adressed in future releases.
It is not currently recommended to use the CompressedPublicKey to encrypt ciphertexts without first decompressing it. In case the resulting PublicKey is too large to fit in memory the encryption with the CompressedPublicKey will be very slow, this is a known problem and will be addressed in future releases.
{% endhint %}

```rust
Expand Down
4 changes: 2 additions & 2 deletions tfhe/docs/how_to/rust_configuration.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Using the right toolchain for TFHE-rs.

TFHE-rs only requires a nighlty toolchain for building the C API and using advanced SIMD instructions, otherwise you can use a stable toolchain (with version >= 1.72 for ARM devices)
TFHE-rs only requires a nightly toolchain for building the C API and using advanced SIMD instructions, otherwise you can use a stable toolchain (with version >= 1.72 for ARM devices)
Install the needed Rust toolchain:

```shell
Expand All @@ -27,7 +27,7 @@ cargo +nightly test

```shell
# This should not be necessary by default, but if you want to make sure your configuration is
# correct you can still set the overriden toolchain to stable
# correct you can still set the overridden toolchain to stable
rustup override set stable
# cargo will use the `stable` toolchain.
cargo build
Expand Down
2 changes: 1 addition & 1 deletion tfhe/docs/how_to/trivial_ciphertext.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Trival Ciphertext
# Trivial Ciphertext

Sometimes, the server side needs to initialize a value.
For example, when computing the sum of a list of ciphertext,
Expand Down
16 changes: 8 additions & 8 deletions tfhe/src/boolean/engine/bootstrapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ impl Bootstrapper {
&mut self,
cks: &ClientKey,
) -> Result<ServerKey, Box<dyn std::error::Error>> {
let standard_bootstraping_key: LweBootstrapKeyOwned<u32> =
let standard_bootstrapping_key: LweBootstrapKeyOwned<u32> =
par_allocate_and_generate_new_lwe_bootstrap_key(
&cks.lwe_secret_key,
&cks.glwe_secret_key,
Expand All @@ -173,14 +173,14 @@ impl Bootstrapper {

// creation of the bootstrapping key in the Fourier domain
let mut fourier_bsk = FourierLweBootstrapKey::new(
standard_bootstraping_key.input_lwe_dimension(),
standard_bootstraping_key.glwe_size(),
standard_bootstraping_key.polynomial_size(),
standard_bootstraping_key.decomposition_base_log(),
standard_bootstraping_key.decomposition_level_count(),
standard_bootstrapping_key.input_lwe_dimension(),
standard_bootstrapping_key.glwe_size(),
standard_bootstrapping_key.polynomial_size(),
standard_bootstrapping_key.decomposition_base_log(),
standard_bootstrapping_key.decomposition_level_count(),
);

let fft = Fft::new(standard_bootstraping_key.polynomial_size());
let fft = Fft::new(standard_bootstrapping_key.polynomial_size());
let fft = fft.as_view();
self.computation_buffers.resize(
convert_standard_lwe_bootstrap_key_to_fourier_mem_optimized_requirement(fft)
Expand All @@ -190,7 +190,7 @@ impl Bootstrapper {

// Conversion to fourier domain
par_convert_standard_lwe_bootstrap_key_to_fourier(
&standard_bootstraping_key,
&standard_bootstrapping_key,
&mut fourier_bsk,
);

Expand Down
2 changes: 1 addition & 1 deletion tfhe/src/boolean/engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub(crate) trait BinaryGatesAssignEngine<L, R, K> {
fn xnor_assign(&mut self, ct_left: L, ct_right: R, server_key: &K);
}

/// Trait to be able to acces thread_local
/// Trait to be able to access thread_local
/// engines in a generic way
pub(crate) trait WithThreadLocalEngine {
fn with_thread_local_mut<R, F>(func: F) -> R
Expand Down
2 changes: 1 addition & 1 deletion tfhe/src/boolean/parameters/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ use serde::{Deserialize, Serialize};
/// first followed by a keyswitch.
/// * The `Small` choice means the small LWE key is used to encrypt the input ciphertext.
/// Performance is not as good as in the `Big` case but (`public
/// key`)[`super::public_key::PublicKey`] sizes are much more manageable and shoud always fit in
/// key`)[`super::public_key::PublicKey`] sizes are much more manageable and should always fit in
/// memory. When refreshing a ciphertext and/or evaluating a table lookup the keyswitch is
/// computed first followed by a PBS.
#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)]
Expand Down
2 changes: 1 addition & 1 deletion tfhe/src/c_api/high_level_api/integers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ macro_rules! impl_operations_for_integer_type {
}

/// Creates a type that will act as an opaque wrapper
/// aroung a tfhe integer.
/// around a tfhe integer.
///
/// It also implements binary operations for this wrapper type
macro_rules! create_integer_wrapper_type {
Expand Down
2 changes: 1 addition & 1 deletion tfhe/src/c_api/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub fn check_ptr_is_non_null_and_aligned<T>(ptr: *const T) -> Result<(), String>
let expected_alignment = std::mem::align_of::<T>();
if ptr as usize % expected_alignment != 0 {
return Err(format!(
"pointer is misaligned, expected {expected_alignment} bytes alignement, got pointer: \
"pointer is misaligned, expected {expected_alignment} bytes alignment, got pointer: \
{ptr:p}. You May have mixed some pointers in your function call. If that's not the \
case check tfhe.h for alignment constants for plain data types allocation.",
));
Expand Down
4 changes: 2 additions & 2 deletions tfhe/src/core_crypto/algorithms/glwe_encryption.rs
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ where

/// Convenience function to share the core logic of the seeded GLWE encryption between all
/// functions needing it.
pub fn encrypt_seeded_glwe_ciphertext_with_exsiting_generator<
pub fn encrypt_seeded_glwe_ciphertext_with_existing_generator<
Scalar,
KeyCont,
OutputCont,
Expand Down Expand Up @@ -988,7 +988,7 @@ pub fn encrypt_seeded_glwe_ciphertext<Scalar, KeyCont, InputCont, OutputCont, No
noise_seeder,
);

encrypt_seeded_glwe_ciphertext_with_exsiting_generator(
encrypt_seeded_glwe_ciphertext_with_existing_generator(
glwe_secret_key,
output_glwe_ciphertext,
input_plaintext_list,
Expand Down
Loading

0 comments on commit 6c5e5e4

Please sign in to comment.