RustCrypto / RustCrypto/crypto-bigint
Square root trait and implementation cleanups
Open
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 309
- Forks
- 96
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 3
Description
Some potential cleanups for the traits and implementation:
- Add a
CheckedSquareRoottrait which could be implemented byInt(returning none for negative inputs). This could be a supertrait of SquareRoot. - Rename the
SquareRoottrait for clarity, perhapsUintSquareRootorFloorSquareRoot. [ ] Implement the square root trait(s) for Montgomery forms (this makes.FloorSquareRoota less desirable name)- Rename
Uint::sqrt/sqrt_vartimetoisqrtorsqrt_uncheckedto reflect the inexact nature of the result (and corresponding trait updates to match). - Implement square root traits and methods for
OddUintfor consistency. This would require changing the return type, but it seems reasonable to add an Output type to the trait(s). - Support nth roots based on algorithm 1.14 from the same source (Brent & Zimmermann, Modern Computer Arithmetic, v0.5.9). Should this be a separate trait?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing square-root traits and the Uint::sqrt/sqrt_vartime and OddUint APIs, then compare the proposed trait names and return types with the issue's remaining tasks. Done would require an agreed design and implementation for OddUint square roots, plus a decision on whether nth roots belong in a separate trait and how algorithm 1.14 applies.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cryptography
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100