Skip to content

Better crypto-bigint Monty multiplication#28

Merged
frozenspider merged 17 commits intomainfrom
feature/better-multiplication
Feb 5, 2026
Merged

Better crypto-bigint Monty multiplication#28
frozenspider merged 17 commits intomainfrom
feature/better-multiplication

Conversation

@frozenspider
Copy link
Collaborator

@frozenspider frozenspider commented Feb 4, 2026

Implement a better algorithm for limbed integer multiplication. Our benches show consistent 10-40% increase in speed for both Monty and ConstMonty, most prominent improvement being product.
This is despite the unfortunately fact that due to RustCrypto/crypto-bigint#1186 we have to recompute mod_neg_inv as it's not accessible in the parameters struct.

Note: This approach, when applied to BoxedMontyField, worsens runtime by ~10-30% due to compile-time optimizations not being applicable to dynamically sized slices

@frozenspider frozenspider changed the title [WIP] Better crypto-bigint Monty multiplication Better crypto-bigint Monty multiplication Feb 4, 2026
@frozenspider frozenspider marked this pull request as ready for review February 4, 2026 19:30
Copy link
Collaborator

@ElijahVlasov ElijahVlasov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@frozenspider
Copy link
Collaborator Author

@ElijahVlasov, I've added some more delegations to the new optimized multiplication, could you please take another look?

@frozenspider frozenspider merged commit 196dd8f into main Feb 5, 2026
9 checks passed
@frozenspider frozenspider deleted the feature/better-multiplication branch February 5, 2026 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants