Skip to content

powermod produces incorrect result #419

@guidovranken

Description

@guidovranken
var sjcl = require('sjcl');

var bn0 = new sjcl.bn('c794');
var bn1 = new sjcl.bn('33');
var bn2 = new sjcl.bn('b');

console.log(bn0.powermod(bn1, bn2).toString());

prints:

0x1a5bd6f3654947df9b7939b126da9f94047e49aa7cbcc2707d02eac675ad742625826d8670c61fdc198291ad991bc0be5803e0b0e

which is evidently incorrect (result is larger than modulo).

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