Skip to content

submod method #7

@dragan2234

Description

@dragan2234

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions