diff options
Diffstat (limited to 'src/lib/math/numbertheory/numthry.cpp')
-rw-r--r-- | src/lib/math/numbertheory/numthry.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/lib/math/numbertheory/numthry.cpp b/src/lib/math/numbertheory/numthry.cpp index fe943cc6b..900e61724 100644 --- a/src/lib/math/numbertheory/numthry.cpp +++ b/src/lib/math/numbertheory/numthry.cpp @@ -176,6 +176,9 @@ BigInt inverse_mod(const BigInt& n, const BigInt& mod) word monty_inverse(word input) { + if(input == 0) + throw std::runtime_error("monty_inverse: divide by zero"); + word b = input; word x2 = 1, x1 = 0, y2 = 0, y1 = 1; |