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

Incorrect mod result with mont reduction #256

Open
SurienDG opened this issue Dec 3, 2020 · 1 comment
Open

Incorrect mod result with mont reduction #256

SurienDG opened this issue Dec 3, 2020 · 1 comment

Comments

@SurienDG
Copy link

SurienDG commented Dec 3, 2020

I did

let red10 = BN.mont(new BN(10, 10));
let red_1 = new BN(104, 10).toRed(red10);
red_1 = red_1.fromRed();
console.log("red_1: " + red_1.toString());

This outputs

red_1: 2

Which is incorrect. It should output red_1: 4 (since 104 mod 10 = 4). I do get the correct if I use BN.red instead if BN.mont

@SurienDG
Copy link
Author

SurienDG commented Dec 3, 2020

Nevermind I read #193 but perhaps we could get some better documentation about 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