1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #include "print_helpers.hpp"
- Fp12e::Fp12e(const fp12e_t& input)
- {
- fp12e_set(data, input);
- }
- Fp6e::Fp6e(const fp6e_t& input)
- {
- fp6e_set(data, input);
- }
- Fp2e::Fp2e(const fp2e_t& input)
- {
- fp2e_set(data, input);
- }
- Fpe::Fpe(const fpe_t& input)
- {
- fpe_set(data, input);
- }
- std::ostream& operator<<(std::ostream& os, const Fp12e& output)
- {
- os << "(" << Fp6e(output.data->m_a) << " * Z + " << Fp6e(output.data->m_b) << ")";
- return os;
- }
- std::ostream& operator<<(std::ostream& os, const Fp6e& output)
- {
- os << "(" << Fp2e(output.data->m_a) << " * Y^2 + " << Fp2e(output.data->m_b) << " * Y + " << Fp2e(output.data->m_c) << ")";
- return os;
- }
- std::ostream& operator<<(std::ostream& os, const Fp2e& output)
- {
- fpe_t a, b;
- fp2e_to_2fpe(a, b, output.data);
- os << "(" << Fpe(a) << " * X + " << Fpe(b) << ")";
- return os;
- }
- std::ostream& operator<<(std::ostream& os, const Fpe& output)
- {
- os << "(";
- for (int i = 0; i < 12; i++)
- {
- os << std::setw(10) << output.data->v[i] << std::setw(0);
- if (i < 11)
- os << ", ";
- }
- os << ")";
- return os;
- }
|