Botan 3.9.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/internal/divide.h>
11
12namespace Botan {
13
14Modular_Reducer::Modular_Reducer(const BigInt& mod) : m_mod_words(mod.sig_words()) {
15 if(mod < 0) {
16 throw Invalid_Argument("Modular_Reducer: modulus must be positive");
17 }
18
19 m_modulus = mod;
20}
21
23 return ct_modulo(x, m_modulus);
24}
25
26} // namespace Botan
BigInt reduce(const BigInt &x) const
Definition reducer.cpp:22
BigInt ct_modulo(const BigInt &x, const BigInt &y)
Definition divide.cpp:192