Botan 2.13.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
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 28 of file gf2m_small_m.h.

## Constructor & Destructor Documentation

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

Definition at line 111 of file gf2m_small_m.cpp.

111 : m_gf_extension_degree(extdeg),
112 m_gf_multiplicative_order((1 << extdeg) - 1),
113 m_gf_log_table(log_table(m_gf_extension_degree)),
114 m_gf_exp_table(exp_table(m_gf_extension_degree))
115 {
116 }

## Member Function Documentation

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

Definition at line 194 of file gf2m_small_m.h.

195 {
196 return static_cast<gf2m>(1 << get_extension_degree());
197 }
Botan::gf2m
uint16_t gf2m
Definition: gf2m_small_m.h:23
Botan::GF2m_Field::get_extension_degree
size_t get_extension_degree() const
Definition: gf2m_small_m.h:189

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

Definition at line 189 of file gf2m_small_m.h.

190 {
191 return m_gf_extension_degree;
192 }

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

Definition at line 118 of file gf2m_small_m.cpp.

References gf_exp(), and gf_log().

119 {
120 const int32_t sub_res = static_cast<int32_t>(gf_log(x) - static_cast<int32_t>(gf_log(y)));
121 const gf2m modq_res = _gf_modq_1(sub_res);
122 const int32_t div_res = static_cast<int32_t>(x) ? static_cast<int32_t>(gf_exp(modq_res)) : 0;
123 return static_cast<gf2m>(div_res);
124 }
Botan::GF2m_Field::gf_log
gf2m gf_log(gf2m i) const
Definition: gf2m_small_m.h:179
Botan::gf2m
uint16_t gf2m
Definition: gf2m_small_m.h:23
Botan::GF2m_Field::gf_exp
gf2m gf_exp(gf2m i) const
Definition: gf2m_small_m.h:174

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

Definition at line 137 of file gf2m_small_m.h.

138 {
139 return gf_exp(_gf_modq_1(a - b));
140 }
Botan::GF2m_Field::gf_exp
gf2m gf_exp(gf2m i) const
Definition: gf2m_small_m.h:174

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

Definition at line 127 of file gf2m_small_m.h.

128 {
129 return _gf_modq_1(gf_log(x) - gf_log(y));
130 }
Botan::GF2m_Field::gf_log
gf2m gf_log(gf2m i) const
Definition: gf2m_small_m.h:179

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

Definition at line 132 of file gf2m_small_m.h.

133 {
134 return _gf_modq_1(gf_log(x) - b);
135 }
Botan::GF2m_Field::gf_log
gf2m gf_log(gf2m i) const
Definition: gf2m_small_m.h:179

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

Definition at line 142 of file gf2m_small_m.h.

143 {
144 return ((x) ? gf_exp(_gf_modq_1(gf_log(x) - b)) : 0);
145 }
Botan::GF2m_Field::gf_log
gf2m gf_log(gf2m i) const
Definition: gf2m_small_m.h:179
Botan::GF2m_Field::gf_exp
gf2m gf_exp(gf2m i) const
Definition: gf2m_small_m.h:174

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

Definition at line 174 of file gf2m_small_m.h.

Referenced by gf_div().

175 {
176 return m_gf_exp_table.at(i); /* alpha^i */
177 }

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

Definition at line 147 of file gf2m_small_m.h.

148 {
149 return gf_exp(gf_ord() - gf_log(x));
150 }
Botan::GF2m_Field::gf_log
gf2m gf_log(gf2m i) const
Definition: gf2m_small_m.h:179
Botan::GF2m_Field::gf_ord
gf2m gf_ord() const
Definition: gf2m_small_m.h:184
Botan::GF2m_Field::gf_exp
gf2m gf_exp(gf2m i) const
Definition: gf2m_small_m.h:174

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

Definition at line 152 of file gf2m_small_m.h.

153 {
154 return (gf_ord() - gf_log(x));
155 }
Botan::GF2m_Field::gf_log
gf2m gf_log(gf2m i) const
Definition: gf2m_small_m.h:179
Botan::GF2m_Field::gf_ord
gf2m gf_ord() const
Definition: gf2m_small_m.h:184

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

Definition at line 167 of file gf2m_small_m.h.

168 {
169 return gf_log(x);
170 }
Botan::GF2m_Field::gf_log
gf2m gf_log(gf2m i) const
Definition: gf2m_small_m.h:179

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

Definition at line 179 of file gf2m_small_m.h.

Referenced by gf_div().

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

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

Definition at line 33 of file gf2m_small_m.h.

34 {
35 return ((x) ? gf_mul_fast(x, y) : 0);
36 }
Botan::GF2m_Field::gf_mul_fast
gf2m gf_mul_fast(gf2m x, gf2m y) const
Definition: gf2m_small_m.h:48

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

Definition at line 48 of file gf2m_small_m.h.

49 {
50 return ((y) ? gf_exp(_gf_modq_1(gf_log(x) + gf_log(y))) : 0);
51 }
Botan::GF2m_Field::gf_log
gf2m gf_log(gf2m i) const
Definition: gf2m_small_m.h:179
Botan::GF2m_Field::gf_exp
gf2m gf_exp(gf2m i) const
Definition: gf2m_small_m.h:174

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

Definition at line 61 of file gf2m_small_m.h.

62 {
63 return (a + b);
64 }

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

Definition at line 86 of file gf2m_small_m.h.

87 {
88 return (gf_log(x) + gf_log(y));
89 }
Botan::GF2m_Field::gf_log
gf2m gf_log(gf2m i) const
Definition: gf2m_small_m.h:179

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

non-zero operand

Definition at line 117 of file gf2m_small_m.h.

118 {
119 return gf_mul_nrn(a, y);
120 }
Botan::GF2m_Field::gf_mul_nrn
gf2m gf_mul_nrn(gf2m a, gf2m y) const
Definition: gf2m_small_m.h:96

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

Definition at line 96 of file gf2m_small_m.h.

97 {
98 return gf_exp(_gf_modq_1((a) + gf_log(y)));
99 }
Botan::GF2m_Field::gf_log
gf2m gf_log(gf2m i) const
Definition: gf2m_small_m.h:179
Botan::GF2m_Field::gf_exp
gf2m gf_exp(gf2m i) const
Definition: gf2m_small_m.h:174

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

Definition at line 71 of file gf2m_small_m.h.

72 {
73 return (gf_exp(gf_mul_rrr(a, b)));
74 }
Botan::GF2m_Field::gf_exp
gf2m gf_exp(gf2m i) const
Definition: gf2m_small_m.h:174
Botan::GF2m_Field::gf_mul_rrr
gf2m gf_mul_rrr(gf2m a, gf2m b) const
Definition: gf2m_small_m.h:66

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

Definition at line 91 of file gf2m_small_m.h.

92 {
93 return _gf_modq_1(gf_mul_lnn(x, y));
94 }
Botan::GF2m_Field::gf_mul_lnn
gf2m gf_mul_lnn(gf2m x, gf2m y) const
Definition: gf2m_small_m.h:86

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

Definition at line 81 of file gf2m_small_m.h.

82 {
83 return gf_mul_rrn(a, y);
84 }
Botan::GF2m_Field::gf_mul_rrn
gf2m gf_mul_rrn(gf2m a, gf2m y) const
Definition: gf2m_small_m.h:76

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

Definition at line 76 of file gf2m_small_m.h.

77 {
78 return _gf_modq_1(gf_mul_lll(a, gf_log(y)));
79 }
Botan::GF2m_Field::gf_mul_lll
gf2m gf_mul_lll(gf2m a, gf2m b) const
Definition: gf2m_small_m.h:61
Botan::GF2m_Field::gf_log
gf2m gf_log(gf2m i) const
Definition: gf2m_small_m.h:179

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

Definition at line 66 of file gf2m_small_m.h.

67 {
68 return (_gf_modq_1(gf_mul_lll(a, b)));
69 }
Botan::GF2m_Field::gf_mul_lll
gf2m gf_mul_lll(gf2m a, gf2m b) const
Definition: gf2m_small_m.h:61

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

zero operand allowed

Definition at line 104 of file gf2m_small_m.h.

105 {
106 return ( (y == 0) ? 0 : gf_mul_nrn(a, y) );
107 }
Botan::GF2m_Field::gf_mul_nrn
gf2m gf_mul_nrn(gf2m a, gf2m y) const
Definition: gf2m_small_m.h:96

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

Definition at line 109 of file gf2m_small_m.h.

110 {
111 return gf_mul_zrz(y, a);
112 }
Botan::GF2m_Field::gf_mul_zrz
gf2m gf_mul_zrz(gf2m a, gf2m y) const
Definition: gf2m_small_m.h:104

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

Definition at line 184 of file gf2m_small_m.h.

185 {
186 return m_gf_multiplicative_order;
187 }

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

Definition at line 122 of file gf2m_small_m.h.

123 {
124 return ((x) ? gf_exp(_gf_modq_1(gf_log(x) << (get_extension_degree()-1))) : 0);
125 }
Botan::GF2m_Field::gf_log
gf2m gf_log(gf2m i) const
Definition: gf2m_small_m.h:179
Botan::GF2m_Field::get_extension_degree
size_t get_extension_degree() const
Definition: gf2m_small_m.h:189
Botan::GF2m_Field::gf_exp
gf2m gf_exp(gf2m i) const
Definition: gf2m_small_m.h:174

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

Definition at line 38 of file gf2m_small_m.h.

39 {
40 return ((x) ? gf_exp(_gf_modq_1(gf_log(x) << 1)) : 0);
41 }
Botan::GF2m_Field::gf_log
gf2m gf_log(gf2m i) const
Definition: gf2m_small_m.h:179
Botan::GF2m_Field::gf_exp
gf2m gf_exp(gf2m i) const
Definition: gf2m_small_m.h:174

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

Definition at line 157 of file gf2m_small_m.h.

158 {
159 return gf_log(x) << 1;
160 }
Botan::GF2m_Field::gf_log
gf2m gf_log(gf2m i) const
Definition: gf2m_small_m.h:179

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

Definition at line 162 of file gf2m_small_m.h.

163 {
164 return a << 1;
165 }

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

Definition at line 43 of file gf2m_small_m.h.

44 {
45 return _gf_modq_1(x << 1);
46 }

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

- src/lib/pubkey/mce/gf2m_small_m.h
- src/lib/pubkey/mce/gf2m_small_m.cpp