-
Notifications
You must be signed in to change notification settings - Fork 152
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
Fhebool boolean block #681
Conversation
And add the trait to the prelude so that users can use it.
@slab-ci cpu_fast_test |
6beae51
to
53f72ed
Compare
@slab-ci cpu_fast_test |
@@ -159,7 +195,7 @@ impl FheTryEncrypt<bool, CompressedPublicKey> for crate::FheBool { | |||
fn try_encrypt(value: bool, key: &CompressedPublicKey) -> Result<Self, Self::Error> { | |||
let key = &key.key; | |||
let ciphertext = key.key.encrypt(u64::from(value)); | |||
Ok(Self::new(ciphertext)) | |||
Ok(Self::new(BooleanBlock::new_unchecked(ciphertext))) |
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.
internally those ops still return a shortint ciphertext ?
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.
Hum, Yeah I haven't added encryt_bool for the different PublicKey types of integer. Should I add them in this PR ?
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.
is it a large change ? otherwise it's fine to put it in a separate PR I would say
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.
I added the 2 missing functions
- This makes FheBool use integer::BooleanBlock internally. - It makes comparisons (eq, ne, le, etc) return a FheBool instead of FheUint/FheInt. - It also moves the if_then_else and cmux methods to FheBool. - Adds casting from FheBool to FheUint/FheInt (but not from FheUint/FheInt to FheBool as we expect users to do `a.ne(0)` as its matches Rust) BREAKING CHANGE: - Comparisons now return FheBool - if_then_else/cmux are now methods of FheBool.
53f72ed
to
ac17660
Compare
@slab-ci cpu_fast_test |
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.
Thanks a lot !
Pull Request has been approved 🎉 |
FheUint/FheInt.
FheUint/FheInt to FheBool as we expect users to do
a.ne(0)
as its matches Rust)
BREAKING CHANGE:
- Comparisons now return FheBool
- if_then_else/cmux are now methods of FheBool.