-
Notifications
You must be signed in to change notification settings - Fork 56
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
Add BoxedUint
: heap-allocated fixed-precision unsigned integers
#221
Conversation
Edit: renamed to |
would be really useful to have benchmarks against gmp and num-bigint-dig for various ops and sizes, even if slower, just so we can orientate things |
Definitely want to add benchmarks, especially to play around with optimizing the carry chain function. @dignifiedquire I didn't think about competitive benchmarks with other crates yet though... that's a good idea! |
Or |
|
I guess a problem with So something other than In interest of keeping it short and familiar, perhaps Naming is hard! |
Some other options: |
Use cases like DSA and RSA benefit from having heap-allocated integers whose precision can be chosen at runtime rather than compile time. These algorithms are used in conjunction with varying key sizes, and when dealing with a large number of potential key sizes it's helpful not to have to monomorphize the algorithm implementation for each one. Ideally we can define traits so that code can be written generically but used with either `Uint` or `BoxedUint`, allowing heapless `no_std` users to use e.g. `U2048`, while users with a heap can use `BoxedUint`. It should also be possible to make some of the existing algorithm implementations generic over `Uint` vs `BoxedUint`. This initial implementation only provides addition and comparison support, but also the initial scaffolding for adding more operations.
UintVec
: heap-allocated fixed-precision integersBoxedUint
: heap-allocated fixed-precision unsigned integers
I went with Going to merge this despite the limited functionality to have a basic scaffold in place. Additional functionality can be added in independent followup PRs. |
Use cases like DSA and RSA benefit from having heap-allocated integers whose precision can be chosen at runtime rather than compile time.
These algorithms are used in conjunction with varying key sizes, and when dealing with a large number of potential key sizes it's helpful not to have to monomorphize the algorithm implementation for each one.
Ideally we can define traits so that code can be written generically but used with either
Uint
orBoxedUint
, allowing heaplessno_std
users to use e.g.U2048
, while users with a heap can useBoxedUint
.It should also be possible to make some of the existing algorithm implementations generic over
Uint
vsBoxedUint
.This initial implementation only provides addition and comparison support, but also the initial scaffolding for adding more operations.
Closes #58