-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(integer): improve shift/rotate by encrypted amount
This commit does a few things: * Changes the BitExtractor to use many_lut to reduce number of PBS done * Add blocks rotation/shift operation * Implement a new algorithm for bit shift/rotation by encrypted amounts * Add support bit shift/rotation for 1_1 parameters (as result of adding block shift/rotation) The gist of the new bit shift/rotation is to use the same idea as the scalar version where we first shift blocks between adjacent blocks, then use a rotation of blocks. Doing this requires to do a division and modulo operation: ```rust let (shift_within_blocks, block_rotations) = (amount / bits_per_block, amount % bits_per_block) ``` When `amount` is clear this operation is simple, when `amount` is encrypted then is harder (`bits_per_block` is always clear). However, when bits_per_block is a power of 2 (e.g 1, 2, 4) `/` and `%` can be made by shifting and bit-masking, which are simple operations. This means the new algorithm is only compatible with 1_1, 2_2, 4_4 but not 3_3. The new algorithm improves the latency as well as the throughput as it requires less PBS in total
- Loading branch information
Showing
9 changed files
with
959 additions
and
349 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.