Botan
3.9.0
Crypto and TLS for C&
src
lib
math
numbertheory
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
12
namespace
Botan
{
13
14
Modular_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
22
BigInt
Modular_Reducer::reduce
(
const
BigInt
& x)
const
{
23
return
ct_modulo
(x, m_modulus);
24
}
25
26
}
// namespace Botan
Botan::BigInt
Definition
bigint.h:25
Botan::Invalid_Argument
Definition
exceptn.h:131
Botan::Modular_Reducer::Modular_Reducer
Modular_Reducer()
Definition
reducer.h:69
Botan::Modular_Reducer::reduce
BigInt reduce(const BigInt &x) const
Definition
reducer.cpp:22
Botan
Definition
alg_id.cpp:13
Botan::ct_modulo
BigInt ct_modulo(const BigInt &x, const BigInt &y)
Definition
divide.cpp:192
Generated by
1.14.0