-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(all): refactor oprf integer and hl APIs #1448
Conversation
49f19ed
to
b6edb08
Compare
In *TFHE-rs*, this is possible through the method `generate_oblivious_pseudo_random` of `FheUint` and `FheInt`. | ||
It relies on the use of the usual server keys. | ||
The method takes two inputs: a seed `Seed`, which could be any `u128` value and an upper bound on the range of the random values `random_bits_count`. | ||
It outputs a `FheIntN` or `FheUintN`, where `N` is the number of bits of the homomorphic integer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not accurate anymore, the bounded method takes the random_bit_count
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
/// Generates an encrypted `num_block` blocks unsigned integer | ||
/// taken uniformly in `[0, 2^random_bits_count[` using the given seed | ||
/// The encryted value is oblivious to the server | ||
/// It can be useful to make server random generation deterministic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docstring does not match the implem, to check all API levels
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
b6edb08
to
ba4e4bf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still some discrepancy between doc and code as fat as I can see
|
||
In *TFHE-rs*, this is possible through the function `generate_oblivious_pseudo_random` of `FheUint` and `FheInt`. | ||
It relies on the use of the usual server keys. | ||
The function takes two inputs: a seed `Seed`, which could be any `u128` value and an upper bound on the range of the random values `random_bits_count`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not right, generate_oblivious_pseudo_random does not take a bit count :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
ba4e4bf
to
6fc2d06
Compare
This document gives an example of generating pseudo random values in FHE that are not known by the server. | ||
This document explains the mechanism and steps to generate an oblivious encrypted random value using only server keys. | ||
|
||
The goal is to give to the server the possibility to generate a random value, which will be obtained in a encrypted format and will remain unknown to the server. The implementation is based on [this article](https://eprint.iacr.org/2024/665). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in a encrypted format -> in an encrypted format
The goal is to give to the server the possibility to generate a random value, which will be obtained in a encrypted format and will remain unknown to the server. The implementation is based on [this article](https://eprint.iacr.org/2024/665). | ||
|
||
This is possible through two methods on `FheUint` and `FheInt`: | ||
- `generate_oblivious_pseudo_random` which return an integer taken uniformly in the full integer range (`[0; 2^N[` for a `FheUint_N` and `[-2^(N-1); 2^(N-1)[` for a `FheInt_N`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FheUintN and FheIntN (no underscores)
// The server cannot know what value was generated | ||
let ct_res = FheUint8::generate_oblivious_pseudo_random(Seed(0), random_bits_count); | ||
let ct_res = FheUint8::generate_oblivious_pseudo_random(Seed(0)); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
decryption of ct_res ?
6fc2d06
to
1e7b567
Compare
No description provided.