Botan
1.11.15
|
#include <blinding.h>
Public Member Functions | |
BigInt | blind (const BigInt &x) const |
Blinder () | |
Blinder (const BigInt &modulus, std::function< BigInt(const BigInt &)> fwd_func, std::function< BigInt(const BigInt &)> inv_func) | |
bool | initialized () const |
BigInt | unblind (const BigInt &x) const |
Blinding Function Object
Definition at line 20 of file blinding.h.
Botan::Blinder::Blinder | ( | ) | [inline] |
Definition at line 29 of file blinding.h.
{}
Botan::Blinder::Blinder | ( | const BigInt & | modulus, |
std::function< BigInt(const BigInt &)> | fwd_func, | ||
std::function< BigInt(const BigInt &)> | inv_func | ||
) |
Definition at line 21 of file blinding.cpp.
References Botan::BigInt::bits(), and Botan::system_rng().
{ m_reducer = Modular_Reducer(modulus); #if defined(BOTAN_HAS_SYSTEM_RNG) auto& rng = system_rng(); #else AutoSeeded_RNG rng; #endif const BigInt k(rng, modulus.bits() - 1); m_e = fwd_func(k); m_d = inv_func(k); }
BigInt Botan::Blinder::blind | ( | const BigInt & | x | ) | const |
Definition at line 39 of file blinding.cpp.
References Botan::Modular_Reducer::initialized(), Botan::Modular_Reducer::multiply(), and Botan::Modular_Reducer::square().
{ if(!m_reducer.initialized()) throw std::runtime_error("Blinder not initialized, cannot blind"); m_e = m_reducer.square(m_e); m_d = m_reducer.square(m_d); return m_reducer.multiply(i, m_e); }
bool Botan::Blinder::initialized | ( | ) | const [inline] |
Definition at line 27 of file blinding.h.
{ return m_reducer.initialized(); }
BigInt Botan::Blinder::unblind | ( | const BigInt & | x | ) | const |
Definition at line 49 of file blinding.cpp.
References Botan::Modular_Reducer::initialized(), and Botan::Modular_Reducer::multiply().
{ if(!m_reducer.initialized()) throw std::runtime_error("Blinder not initialized, cannot unblind"); return m_reducer.multiply(i, m_d); }