Skip to content
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

SOT-177: Add Montgomery term #81

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

SOT-177: Add Montgomery term #81

wants to merge 1 commit into from

Conversation

VanhGer
Copy link
Contributor

@VanhGer VanhGer commented Aug 21, 2024

Check List

  • Did you check your grammar / reader proof your document using ChatGPT?
  • Don't forget to squash commits into meaningful chunks before merging
  • After merging this, please update your task status!
  • Did you verify that your math formulas are rendered correctly?

Copy link

linear bot commented Aug 21, 2024

@VanhGer VanhGer requested a review from zk-steve August 21, 2024 11:00
This technique replaces division by $n$ with division by a power of $2$, , which is easily performed on a computer since numbers are
represented in binary form.

To achieve this, we need to convert all the numbers we use into Montgomery space. The $n$-residue of $a$ in Montgomery space is given
Copy link
Contributor

Choose a reason for hiding this comment

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

achieve what ?

To compute this product, we need to determine $r^{-1}$, which satisfies the property:

$r \cdot r^{-1} = 1 \mod n$
$\iff r \cdot r^{-1} - n \cdot n' = 1$
Copy link
Contributor

Choose a reason for hiding this comment

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

n' ?

We show how to compute $9 * 11 \mod 13$ ($= 8$). We have:

- $r = 2^4 = 16$
- Using the Extended Euclid algorithm, we determine that $16 ** 9 − 13 * 11 = 1$, thus, $r^{-1} = 9, n' = 11$
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- Using the Extended Euclid algorithm, we determine that $16 ** 9 − 13 * 11 = 1$, thus, $r^{-1} = 9, n' = 11$
- Using the Extended Euclid algorithm, we determine that $16 * 9 − 13 * 11 = 1$, thus, $r^{-1} = 9, n' = 11$

We show how to compute $x = 7^{10} \mod 13$ ($=4$). We have:

- $r = 2^4 = 16$
- Using the Extended Euclid algorithm, we determine that $16 ** 9 − 13 * 11 = 1$, thus, $r^{-1} = 9, n' = 11$
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- Using the Extended Euclid algorithm, we determine that $16 ** 9 − 13 * 11 = 1$, thus, $r^{-1} = 9, n' = 11$
- Using the Extended Euclid algorithm, we determine that $16 * 9 − 13 * 11 = 1$, thus, $r^{-1} = 9, n' = 11$

Therefore, we can find $r^{-1}$ and $n'$ using the
[Extended Euclid algorithm](https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm). We can express $\bar{R}$ as follows:

$\bar R = \bar a \cdot \bar b \cdot r^{-1} \mod n$
Copy link
Contributor

Choose a reason for hiding this comment

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

use array to align equations

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