-
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
Documentation of modular multiplication #287
Comments
#313 provides a simpler API for dynamic moduli (via the |
Where does this currently stand? If we were to produce docs on this, where should they live? powmod is another area that might need attention as well. |
We could use some more examples in the toplevel documentation of the |
is the approach taken above by @matthiasgeihs sufficient in this case for mul mod or is there something more optimal. I do see that #313 is merged but its still unclear what method remains preferred. |
That sort of example seems fine if you'd like to add it to the rustdoc, although the macro names will need to be updated, e.g. to |
See #562. Realizing that in ~v0.6, |
How so? |
Had to dig around through the unit tests to see how it was being used. In the most recent version though it was really nice and seamless, very easy to use |
Feel free to close this issue if you think it is solved. Haven’t had time to look into this recently. |
This relates to #150 and #283.
In the discussion of #150 it is mentioned that modular multiplication is possible via
Residue
.However, I did not find an example that shows how
Residue
is used correctly and it also wasn't immediately apparent to me.After a bit of searching, I found the macro
const_residue
, which seems to allow the creation of aResidue
object.crypto-bigint/src/uint/modular/constant_mod/macros.rs
Lines 50 to 53 in ef32e28
However, there are several issues with the example
residue!(U256::from(105u64), MyModulus);
:const_residue
(and notresidue
).U256::from(105u64)
is not a valid argument to the macro. (no rules expected the token `::`
)MyModulus
needs to be defined before, which is not evident by the example itself.Because of these things, it cost me a bit of time to get modular multiplication working. For reference, this is a minimal working example:
I think it would be nice if a more explicit (and correct) example would be included in the documentation.
The text was updated successfully, but these errors were encountered: