-
Notifications
You must be signed in to change notification settings - Fork 32
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
[Feature Request] Random BigInt #101
Comments
FYI I learned relatively recently that this randomization of tests is called fuzzing in the InfoSec domain |
I am not sure we can call this fuzzing, that is why I purposely avoided the term. One use case would be eg. for the gcd. We have that for some a, b, c integers : gcd(gcd(a, b), c) = gcd(a, gcd(b, c)) I guess this does not prove necessarily that the algorithm computes the gcd, but at least that the function coded verifies the functional equation :
which is (intuitively) rare to happen for a pseudo-random function and for a sufficiently large number of queries with uniformly random inputs. I have not learnt how to do this. I only write tests so far manually. Automated tests for random numbers would enable users to report such edge cases if they encounter them by chance. |
That's a mutation-based fuzzer (which the more specialized kind of fuzzers). Here are RNG strategies I use to find bugs in Constantine:
The last one in particular has been instrumental in finding CVEs in OpenSSL that mutation-based fuzzers have a hard time to find (because cryptographic code has no branches and mutation-based fuzzer use branches to guide their coverage) See:
Be prepared for a couple days of fixing bugs after adding those: mratsim/constantine#53 (comment) |
I would like a function to generate a uniformly (as much as possible) random BigInt inferior to some upper bound.
This would enable to randomize tests.
The text was updated successfully, but these errors were encountered: