This repository has been archived by the owner on Dec 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add upper bound for encrypted random integers
Add an upper bound for encrypted random integers by introducing a separate precompile that does a modulo operation before trivially encrypting the result. Generate encrypted random integers in the [0, upperBound) range where upperBound is a power of 2. If the given upperBound is not a power of 2, return an error. Reason for using powers of 2 is potential performance benefit when using an FHE-based random number generation in comparisson to an arbitrary upperBound. Avoid potential out-of-bound indexing of input in `FheLib`. The start index would be invalid if the actual input is exactly 4 bytes - in that case, indexing would start from index 4 and that doesn't exist. Fix by taking the min of 4 and len(input) - 1. Add unit tests for encrypted random number generation with an upperBound.
- Loading branch information
1 parent
b32ca7a
commit 34f611c
Showing
3 changed files
with
301 additions
and
73 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.