paritytech / paritytech/parity-common

Multiplying two UINT256 to a UINT512

Open
#701 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Z1-question
Dominant language
Rust
Stars
311
Forks
245
PR merge metrics
No merged PRs in 30d

Description

Hello,

I need to compute a multiplication of two integers a, b modulo a big prime P. Those integers and the prime fit in a UINT256, but to compute the result of a*b mod P I need to compute a*b which doesn't fit in a UINT256. Would it be possible to add another method perfect_mul (or another name) which gives the UINT512 result in an efficient way or should I use UINT512 everywhere?

Thanks for your work,
Thomas

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the UINT256 and UINT512 implementations and their existing multiplication APIs in the Rust crates. Review how modular arithmetic and overflow are currently handled, then determine whether a dedicated widening multiplication API is appropriate. Done means the chosen API computes the full product efficiently and has coverage for multiplying two UINT256 values.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cryptography
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.