Botan 3.11.0
Crypto and TLS for C&
reducer.cpp
Go to the documentation of this file.
1/*
2* Modular Reducer
3* (C) 1999-2011,2018,2025 Jack Lloyd
4*
5* Botan is released under the Simplified BSD License (see license.txt)
6*/
7
8#include <botan/reducer.h>
9
10#include <botan/exceptn.h>
11#include <botan/internal/divide.h>
12
13namespace Botan {
14
15Modular_Reducer::Modular_Reducer(const BigInt& mod) : m_mod_words(mod.sig_words()) {
16 if(mod < 0) {
17 throw Invalid_Argument("Modular_Reducer: modulus must be positive");
18 }
19
20 m_modulus = mod;
21}
22
24 return ct_modulo(x, m_modulus);
25}
26
27} // namespace Botan
BigInt reduce(const BigInt &x) const
Definition reducer.cpp:23
BigInt ct_modulo(const BigInt &x, const BigInt &y)
Definition divide.cpp:192