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

submod method #7

Open
dragan2234 opened this issue Jan 6, 2023 · 0 comments
Open

submod method #7

dragan2234 opened this issue Jan 6, 2023 · 0 comments

Comments

@dragan2234
Copy link

dragan2234 commented Jan 6, 2023

Note that if b>n this method:
https://github.com/musalbas/solidity-BN256G2/blob/master/BN256G2.sol#L151

doesn't give the correct representation of (n-b). It gives 2^256+(n-b).

Example: submod(3,11,10) would give you addmod(3,(10-11),10).

10-11 in solidity is 2^256-1 which is 115792089237316195423570985008687907853269984665640564039457584007913129639935

so 3 + 115792089237316195423570985008687907853269984665640564039457584007913129639935 modulo 10 is 8, not 3-11 mod 10 which is 2.

I don't know if that's the issue for the project, I just wanted to note this.

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

No branches or pull requests

1 participant