Botan 3.6.1
Crypto and TLS for C&
Botan::GF2m_Field Class Reference

#include <gf2m_small_m.h>

Public Member Functions

gf2m get_cardinality () const
 
size_t get_extension_degree () const
 
 GF2m_Field (size_t extdeg)
 
gf2m gf_div (gf2m x, gf2m y) const
 
gf2m gf_div_nrr (gf2m a, gf2m b) const
 
gf2m gf_div_rnn (gf2m x, gf2m y) const
 
gf2m gf_div_rnr (gf2m x, gf2m b) const
 
gf2m gf_div_zzr (gf2m x, gf2m b) const
 
gf2m gf_exp (gf2m i) const
 
gf2m gf_inv (gf2m x) const
 
gf2m gf_inv_rn (gf2m x) const
 
gf2m gf_l_from_n (gf2m x) const
 
gf2m gf_log (gf2m i) const
 
gf2m gf_mul (gf2m x, gf2m y) const
 
gf2m gf_mul_fast (gf2m x, gf2m y) const
 
gf2m gf_mul_lll (gf2m a, gf2m b) const
 
gf2m gf_mul_lnn (gf2m x, gf2m y) const
 
gf2m gf_mul_nnr (gf2m y, gf2m a) const
 
gf2m gf_mul_nrn (gf2m a, gf2m y) const
 
gf2m gf_mul_nrr (gf2m a, gf2m b) const
 
gf2m gf_mul_rnn (gf2m x, gf2m y) const
 
gf2m gf_mul_rnr (gf2m y, gf2m a) const
 
gf2m gf_mul_rrn (gf2m a, gf2m y) const
 
gf2m gf_mul_rrr (gf2m a, gf2m b) const
 
gf2m gf_mul_zrz (gf2m a, gf2m y) const
 
gf2m gf_mul_zzr (gf2m a, gf2m y) const
 
gf2m gf_ord () const
 
gf2m gf_sqrt (gf2m x) const
 
gf2m gf_square (gf2m x) const
 
gf2m gf_square_ln (gf2m x) const
 
gf2m gf_square_rr (gf2m a) const
 
gf2m square_rr (gf2m x) const
 

Detailed Description

GF(2^m) field for m = [2...16]

Definition at line 25 of file gf2m_small_m.h.

Constructor & Destructor Documentation

◆ GF2m_Field()

Botan::GF2m_Field::GF2m_Field ( size_t extdeg)
explicit

Definition at line 108 of file gf2m_small_m.cpp.

108 :
109 m_gf_extension_degree(extdeg),
110 m_gf_multiplicative_order((1 << extdeg) - 1),
111 m_gf_log_table(log_table(m_gf_extension_degree)),
112 m_gf_exp_table(exp_table(m_gf_extension_degree)) {}

Member Function Documentation

◆ get_cardinality()

gf2m Botan::GF2m_Field::get_cardinality ( ) const
inline

Definition at line 103 of file gf2m_small_m.h.

103{ return static_cast<gf2m>(1 << get_extension_degree()); }
size_t get_extension_degree() const
uint16_t gf2m

◆ get_extension_degree()

size_t Botan::GF2m_Field::get_extension_degree ( ) const
inline

Definition at line 101 of file gf2m_small_m.h.

101{ return m_gf_extension_degree; }

◆ gf_div()

gf2m Botan::GF2m_Field::gf_div ( gf2m x,
gf2m y ) const

Definition at line 114 of file gf2m_small_m.cpp.

114 {
115 const int32_t sub_res = static_cast<int32_t>(gf_log(x) - static_cast<int32_t>(gf_log(y)));
116 const gf2m modq_res = _gf_modq_1(sub_res);
117 const int32_t div_res = static_cast<int32_t>(x) ? static_cast<int32_t>(gf_exp(modq_res)) : 0;
118 return static_cast<gf2m>(div_res);
119}
gf2m gf_exp(gf2m i) const
gf2m gf_log(gf2m i) const

References gf_exp(), and gf_log().

◆ gf_div_nrr()

gf2m Botan::GF2m_Field::gf_div_nrr ( gf2m a,
gf2m b ) const
inline

Definition at line 79 of file gf2m_small_m.h.

79{ return gf_exp(_gf_modq_1(a - b)); }
const SIMD_8x32 & b

References Botan::b.

◆ gf_div_rnn()

gf2m Botan::GF2m_Field::gf_div_rnn ( gf2m x,
gf2m y ) const
inline

Definition at line 75 of file gf2m_small_m.h.

75{ return _gf_modq_1(gf_log(x) - gf_log(y)); }

◆ gf_div_rnr()

gf2m Botan::GF2m_Field::gf_div_rnr ( gf2m x,
gf2m b ) const
inline

Definition at line 77 of file gf2m_small_m.h.

77{ return _gf_modq_1(gf_log(x) - b); }

References Botan::b.

◆ gf_div_zzr()

gf2m Botan::GF2m_Field::gf_div_zzr ( gf2m x,
gf2m b ) const
inline

Definition at line 81 of file gf2m_small_m.h.

81{ return ((x) ? gf_exp(_gf_modq_1(gf_log(x) - b)) : 0); }

References Botan::b.

◆ gf_exp()

gf2m Botan::GF2m_Field::gf_exp ( gf2m i) const
inline

Definition at line 95 of file gf2m_small_m.h.

95{ return m_gf_exp_table.at(i); /* alpha^i */ }

Referenced by gf_div().

◆ gf_inv()

gf2m Botan::GF2m_Field::gf_inv ( gf2m x) const
inline

Definition at line 83 of file gf2m_small_m.h.

83{ return gf_exp(gf_ord() - gf_log(x)); }
gf2m gf_ord() const

◆ gf_inv_rn()

gf2m Botan::GF2m_Field::gf_inv_rn ( gf2m x) const
inline

Definition at line 85 of file gf2m_small_m.h.

85{ return (gf_ord() - gf_log(x)); }

◆ gf_l_from_n()

gf2m Botan::GF2m_Field::gf_l_from_n ( gf2m x) const
inline

Definition at line 91 of file gf2m_small_m.h.

91{ return gf_log(x); }

◆ gf_log()

gf2m Botan::GF2m_Field::gf_log ( gf2m i) const
inline

Definition at line 97 of file gf2m_small_m.h.

97{ return m_gf_log_table.at(i); /* return i when x=alpha^i */ }

Referenced by gf_div().

◆ gf_mul()

gf2m Botan::GF2m_Field::gf_mul ( gf2m x,
gf2m y ) const
inline

Definition at line 29 of file gf2m_small_m.h.

29{ return ((x) ? gf_mul_fast(x, y) : 0); }
gf2m gf_mul_fast(gf2m x, gf2m y) const

◆ gf_mul_fast()

gf2m Botan::GF2m_Field::gf_mul_fast ( gf2m x,
gf2m y ) const
inline

Definition at line 35 of file gf2m_small_m.h.

35{ return ((y) ? gf_exp(_gf_modq_1(gf_log(x) + gf_log(y))) : 0); }

◆ gf_mul_lll()

gf2m Botan::GF2m_Field::gf_mul_lll ( gf2m a,
gf2m b ) const
inline

Definition at line 45 of file gf2m_small_m.h.

45{ return (a + b); }

References Botan::b.

◆ gf_mul_lnn()

gf2m Botan::GF2m_Field::gf_mul_lnn ( gf2m x,
gf2m y ) const
inline

Definition at line 55 of file gf2m_small_m.h.

55{ return (gf_log(x) + gf_log(y)); }

◆ gf_mul_nnr()

gf2m Botan::GF2m_Field::gf_mul_nnr ( gf2m y,
gf2m a ) const
inline

non-zero operand

Definition at line 71 of file gf2m_small_m.h.

71{ return gf_mul_nrn(a, y); }
gf2m gf_mul_nrn(gf2m a, gf2m y) const

◆ gf_mul_nrn()

gf2m Botan::GF2m_Field::gf_mul_nrn ( gf2m a,
gf2m y ) const
inline

Definition at line 59 of file gf2m_small_m.h.

59{ return gf_exp(_gf_modq_1((a) + gf_log(y))); }

◆ gf_mul_nrr()

gf2m Botan::GF2m_Field::gf_mul_nrr ( gf2m a,
gf2m b ) const
inline

Definition at line 49 of file gf2m_small_m.h.

49{ return (gf_exp(gf_mul_rrr(a, b))); }
gf2m gf_mul_rrr(gf2m a, gf2m b) const

References Botan::b.

◆ gf_mul_rnn()

gf2m Botan::GF2m_Field::gf_mul_rnn ( gf2m x,
gf2m y ) const
inline

Definition at line 57 of file gf2m_small_m.h.

57{ return _gf_modq_1(gf_mul_lnn(x, y)); }
gf2m gf_mul_lnn(gf2m x, gf2m y) const

◆ gf_mul_rnr()

gf2m Botan::GF2m_Field::gf_mul_rnr ( gf2m y,
gf2m a ) const
inline

Definition at line 53 of file gf2m_small_m.h.

53{ return gf_mul_rrn(a, y); }
gf2m gf_mul_rrn(gf2m a, gf2m y) const

◆ gf_mul_rrn()

gf2m Botan::GF2m_Field::gf_mul_rrn ( gf2m a,
gf2m y ) const
inline

Definition at line 51 of file gf2m_small_m.h.

51{ return _gf_modq_1(gf_mul_lll(a, gf_log(y))); }
gf2m gf_mul_lll(gf2m a, gf2m b) const

◆ gf_mul_rrr()

gf2m Botan::GF2m_Field::gf_mul_rrr ( gf2m a,
gf2m b ) const
inline

Definition at line 47 of file gf2m_small_m.h.

47{ return (_gf_modq_1(gf_mul_lll(a, b))); }

References Botan::b.

◆ gf_mul_zrz()

gf2m Botan::GF2m_Field::gf_mul_zrz ( gf2m a,
gf2m y ) const
inline

zero operand allowed

Definition at line 64 of file gf2m_small_m.h.

64{ return ((y == 0) ? 0 : gf_mul_nrn(a, y)); }

◆ gf_mul_zzr()

gf2m Botan::GF2m_Field::gf_mul_zzr ( gf2m a,
gf2m y ) const
inline

Definition at line 66 of file gf2m_small_m.h.

66{ return gf_mul_zrz(y, a); }
gf2m gf_mul_zrz(gf2m a, gf2m y) const

◆ gf_ord()

gf2m Botan::GF2m_Field::gf_ord ( ) const
inline

Definition at line 99 of file gf2m_small_m.h.

99{ return m_gf_multiplicative_order; }

◆ gf_sqrt()

gf2m Botan::GF2m_Field::gf_sqrt ( gf2m x) const
inline

Definition at line 73 of file gf2m_small_m.h.

73{ return ((x) ? gf_exp(_gf_modq_1(gf_log(x) << (get_extension_degree() - 1))) : 0); }

◆ gf_square()

gf2m Botan::GF2m_Field::gf_square ( gf2m x) const
inline

Definition at line 31 of file gf2m_small_m.h.

31{ return ((x) ? gf_exp(_gf_modq_1(gf_log(x) << 1)) : 0); }

◆ gf_square_ln()

gf2m Botan::GF2m_Field::gf_square_ln ( gf2m x) const
inline

Definition at line 87 of file gf2m_small_m.h.

87{ return gf_log(x) << 1; }

◆ gf_square_rr()

gf2m Botan::GF2m_Field::gf_square_rr ( gf2m a) const
inline

Definition at line 89 of file gf2m_small_m.h.

89{ return a << 1; }

◆ square_rr()

gf2m Botan::GF2m_Field::square_rr ( gf2m x) const
inline

Definition at line 33 of file gf2m_small_m.h.

33{ return _gf_modq_1(x << 1); }

The documentation for this class was generated from the following files: