You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tfhe/docs/tutorials/ascii_fhe_string.md
+53-9Lines changed: 53 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,13 @@
1
1
# Homomorphic case changing on Ascii string
2
2
3
-
This tutorial demonstrates how to build a data type that represents an ASCII string in Fully Homomorphic Encryption (FHE) by implementing to\_lower and to\_upper functions.
3
+
This tutorial demonstrates how to build your own data type that represents an ASCII string in Fully Homomorphic Encryption (FHE) by implementing to\_lower and to\_upper functions.
4
4
5
-
An ASCII character is stored in 7 bits. To store an encrypted ASCII, we use the `FheUint8`:
5
+
{% hint style="info" %}
6
+
Since version 0.11, **TFHE-rs** has introduced the `strings` feature, which provides an easy to use FHE strings API. See the [fhe strings guide](../guides/strings.md) for more information.
7
+
{% endhint %}
8
+
9
+
10
+
An ASCII character is stored in 7 bits. In this tutorial, we use the `FheUint8` to store an encrypted ASCII:
6
11
7
12
* The uppercase letters are in the range \[65, 90]
8
13
* The lowercase letters are in the range \[97, 122]
@@ -24,13 +29,10 @@ To use the `FheUint8` type, enable the `integer` feature:
24
29
# Cargo.toml
25
30
26
31
[dependencies]
27
-
# Default configuration for x86 Unix machines:
28
32
tfhe = { version = "0.11.1", features = ["integer"] }
29
33
```
30
34
31
-
Refer to the [installation guide](../getting\_started/installation.md) for other configurations.
32
-
33
-
The `FheAsciiString::encrypt` function performs data validation to ensure the input string contains only ASCII characters.
35
+
The `MyFheString::encrypt` function performs data validation to ensure the input string contains only ASCII characters.
34
36
35
37
In FHE operations, direct branching on encrypted values is not possible. However, you can evaluate a boolean condition to obtain the desired outcome. Here is an example to check and convert the 'char' to a lowercase without using a branch:
36
38
@@ -83,7 +85,7 @@ use tfhe::{generate_keys, set_server_key, ClientKey, ConfigBuilder, FheUint8};
0 commit comments