9GF2_32::Element GF2_32::Multiply(Element a, Element b)
const
16 table[2] = m_modulus ^ (a<<1);
22 table[3] = m_modulus ^ (a<<1);
25#if CRYPTOPP_FAST_ROTATE(32)
26 b = rotrConstant<30>(b);
27 word32 result = table[b&2];
29 for (
int i=29; i>=0; --i)
31 b = rotlConstant<1>(b);
32 result = (result<<1) ^ table[(b&2) + (result>>31)];
35 return (b&1) ? result ^ a : result;
37 word32 result = table[(b>>30) & 2];
39 for (
int i=29; i>=0; --i)
40 result = (result<<1) ^ table[((b>>i)&2) + (result>>31)];
42 return (b&1) ? result ^ a : result;
46GF2_32::Element GF2_32::MultiplicativeInverse(Element a)
const
52 word32 g0=m_modulus, g1=a, g2=a;
57 while (!(g2 & 0x80000000))
71 if (g1 < g0 || ((g0^g1) < g0 && (g0^g1) < g1))
80 g2 = g0; g0 = g1; g1 = g2;
81 v2 = v0; v0 = v1; v1 = v2;
unsigned int word32
32-bit unsigned datatype
Classes and functions for schemes over GF(2^32)
Utility functions for the Crypto++ library.
unsigned int BitPrecision(const T &value)
Returns the number of bits required for a value.
Crypto++ library namespace.
#define CRYPTOPP_ASSERT(exp)
Debugging and diagnostic assertion.