Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
bn::Fp12T< T > Struct Template Reference

#include <bn.h>

Inheritance diagram for bn::Fp12T< T >:
Collaboration diagram for bn::Fp12T< T >:

Classes

struct  Dbl
 

Public Types

typedef T Fp6
 
typedef Fp6::Fp2 Fp2
 
typedef Fp6::Fp Fp
 
typedef ParamT< Fp2Param
 
typedef Fp2::Dbl Fp2Dbl
 
typedef Fp6::Dbl Fp6Dbl
 

Public Member Functions

 Fp12T ()
 
 Fp12T (int x)
 
 Fp12T (const Fp6 &a, const Fp6 &b)
 
 Fp12T (const Fp &a0, const Fp &a1, const Fp &a2, const Fp &a3, const Fp &a4, const Fp &a5, const Fp &a6, const Fp &a7, const Fp &a8, const Fp &a9, const Fp &a10, const Fp &a11)
 
 Fp12T (const Fp2 &a0, const Fp2 &a1, const Fp2 &a2, const Fp2 &a3, const Fp2 &a4, const Fp2 &a5)
 
void clear ()
 
Fpget ()
 
const Fpget () const
 
Fp2getFp2 ()
 
const Fp2getFp2 () const
 
void set (const Fp2 &v0, const Fp2 &v1, const Fp2 &v2, const Fp2 &v3, const Fp2 &v4, const Fp2 &v5)
 
bool isZero () const
 
bool operator== (const Fp12T &rhs) const
 
bool operator!= (const Fp12T &rhs) const
 
void Fp2_2z_add_3x (Fp2 &z, const Fp2 &x)
 
void sqru ()
 
void sqru (Fp12T &zz) const
 
void inverse ()
 
void Frobenius (Fp12T &z) const
 
void Frobenius2 (Fp12T &z) const
 
void Frobenius3 (Fp12T &z) const
 
void mapToCyclo (Fp12T &z)
 
void final_exp ()
 
- Public Member Functions inherited from mie::local::addsubmul< Fp12T< T > >
MIE_FORCE_INLINE Toperator+= (const N &rhs)
 
MIE_FORCE_INLINE Toperator-= (const T &rhs)
 
MIE_FORCE_INLINE Toperator*= (const T &rhs)
 

Static Public Member Functions

static void add (Fp12T &z, const Fp12T &x, const Fp12T &y)
 
static void sub (Fp12T &z, const Fp12T &x, const Fp12T &y)
 
static void neg (Fp12T &z, const Fp12T &x)
 
static void mulC (Fp12T &z, const Fp12T &x, const Fp12T &y)
 
static void squareC (Fp12T &z)
 
static void sq_Fp4UseDbl (Fp2 &z0, Fp2 &z1, const Fp2 &x0, const Fp2 &x1)
 

Public Attributes

Fp6 a_
 
Fp6 b_
 

Static Public Attributes

static void(* mul )(Fp12T &z, const Fp12T &x, const Fp12T &y)
 
static void(* square )(Fp12T &z)
 

Friends

std::ostream & operator<< (std::ostream &os, const Fp12T &x)
 
std::istream & operator>> (std::istream &is, Fp12T &x)
 

Detailed Description

template<class T>
struct bn::Fp12T< T >

Definition at line 1363 of file bn.h.

Member Typedef Documentation

◆ Fp

template<class T >
Fp6::Fp bn::Fp12T< T >::Fp

Definition at line 1366 of file bn.h.

◆ Fp2

template<class T >
Fp6::Fp2 bn::Fp12T< T >::Fp2

Definition at line 1365 of file bn.h.

◆ Fp2Dbl

template<class T >
Fp2::Dbl bn::Fp12T< T >::Fp2Dbl

Definition at line 1368 of file bn.h.

◆ Fp6

template<class T >
T bn::Fp12T< T >::Fp6

Definition at line 1364 of file bn.h.

◆ Fp6Dbl

template<class T >
Fp6::Dbl bn::Fp12T< T >::Fp6Dbl

Definition at line 1369 of file bn.h.

◆ Param

template<class T >
ParamT<Fp2> bn::Fp12T< T >::Param

Definition at line 1367 of file bn.h.

Constructor & Destructor Documentation

◆ Fp12T() [1/5]

template<class T >
bn::Fp12T< T >::Fp12T ( )
inline

Definition at line 1372 of file bn.h.

1372{ }

◆ Fp12T() [2/5]

template<class T >
bn::Fp12T< T >::Fp12T ( int x)
inline

Definition at line 1373 of file bn.h.

1374 : a_(x)
1375 , b_(0)
1376 {
1377 }
Fp6 a_
Definition bn.h:1371
Fp6 b_
Definition bn.h:1371

◆ Fp12T() [3/5]

template<class T >
bn::Fp12T< T >::Fp12T ( const Fp6 & a,
const Fp6 & b )
inline

Definition at line 1378 of file bn.h.

1379 : a_(a)
1380 , b_(b)
1381 {
1382 }
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181

◆ Fp12T() [4/5]

template<class T >
bn::Fp12T< T >::Fp12T ( const Fp & a0,
const Fp & a1,
const Fp & a2,
const Fp & a3,
const Fp & a4,
const Fp & a5,
const Fp & a6,
const Fp & a7,
const Fp & a8,
const Fp & a9,
const Fp & a10,
const Fp & a11 )
inline

Definition at line 1383 of file bn.h.

1385 : a_(a0, a1, a2, a3, a4, a5)
1386 , b_(a6, a7, a8, a9, a10, a11)
1387 {
1388 }

◆ Fp12T() [5/5]

template<class T >
bn::Fp12T< T >::Fp12T ( const Fp2 & a0,
const Fp2 & a1,
const Fp2 & a2,
const Fp2 & a3,
const Fp2 & a4,
const Fp2 & a5 )
inline

Definition at line 1390 of file bn.h.

1391 : a_(a0, a1, a2)
1392 , b_(a3, a4, a5)
1393 {
1394 }

Member Function Documentation

◆ add()

template<class T >
static void bn::Fp12T< T >::add ( Fp12T< T > & z,
const Fp12T< T > & x,
const Fp12T< T > & y )
inlinestatic

Definition at line 1432 of file bn.h.

1433 {
1434 Fp6::add(z.a_, x.a_, y.a_);
1435 Fp6::add(z.b_, x.b_, y.b_);
1436 }
uint64_t y
Definition sha3.cpp:34
static void(* add)(Fp6T &z, const Fp6T &x, const Fp6T &y)
Definition bn.h:982
Here is the caller graph for this function:

◆ clear()

template<class T >
void bn::Fp12T< T >::clear ( )
inline

Definition at line 1396 of file bn.h.

1397 {
1398 a_.clear();
1399 b_.clear();
1400 }
Here is the caller graph for this function:

◆ final_exp()

template<class T >
void bn::Fp12T< T >::final_exp ( )
inline

Definition at line 1776 of file bn.h.

1777 {
1778 Fp12T f, f2z, f6z, f6z2, f12z3;
1779 Fp12T a, b;
1780 Fp12T& z = *this;
1781 mapToCyclo(f);
1782
1783#ifdef BN_SUPPORT_SNARK
1784 Fp12T::pow_neg_t(f2z, f);
1785 f2z.sqru(); // f2z = f^(-2*z)
1786 f2z.sqru(f6z);
1787 f6z *= f2z; // f6z = f^(-6*z)
1788 Fp12T::pow_neg_t(f6z2, f6z);
1789 // A variable a is unnecessary only here.
1790 f6z2.sqru(a);
1791 // Compress::fixed_power(f12z3, a); // f12z3 = f^(-12*z^3)
1792 Fp12T::pow_neg_t(f12z3, a);
1793 // It will compute inversion of f2z, thus, conjugation free.
1794 Fp6::neg(f6z.b_, f6z.b_); // f6z = f^(6z)
1795 Fp6::neg(f12z3.b_, f12z3.b_); // f12z3 = f^(12*z^3)
1796 // Computes a and b.
1797 Fp12T::mul(a, f12z3, f6z2); // a = f^(12*z^3 + 6z^2)
1798 a *= f6z; // a = f^(12*z^3 + 6z^2 + 6z)
1799 Fp12T::mul(b, a, f2z); // b = f^(12*z^3 + 6z^2 + 4z)w
1800 // @note f2z, f6z, and f12z are unnecessary from here.
1801 // Last part.
1802 Fp12T::mul(z, a, f6z2); // z = f^(12*z^3 + 12z^2 + 6z)
1803 z *= f; // z = f^(12*z^3 + 12z^2 + 6z + 1)
1804 b.Frobenius(f2z); // f2z = f^(q(12*z^3 + 6z^2 + 4z))
1805 z *= f2z; // z = f^(q(12*z^3 + 6z^2 + 4z) + (12*z^3 + 12z^2 + 6z + 1))
1806 a.Frobenius2(f2z); // f2z = f^(q^2(12*z^3 + 6z^2 + 6z))
1807 z *= f2z; // z = f^(q^2(12*z^3 + 6z^2 + 6z) + q(12*z^3 + 6z^2 + 4z) + (12*z^3 + 12z^2 + 6z + 1))
1808 Fp6::neg(f.b_, f.b_); // f = -f
1809 b *= f; // b = f^(12*z^3 + 6z^2 + 4z - 1)
1810 b.Frobenius3(f2z); // f2z = f^(q^3(12*z^3 + 6z^2 + 4z - 1))
1811 z *= f2z;
1812 // z = f^(q^3(12*z^3 + 6z^2 + 4z - 1) +
1813 // q^2(12*z^3 + 6z^2 + 6z) +
1814 // q(12*z^3 + 6z^2 + 4z) +
1815 // (12*z^3 + 12z^2 + 6z + 1))
1816 // see page 6 in the "Faster hashing to G2" paper
1817#else
1818 // Hard part starts from here.
1819 // Computes addition chain.
1820 typedef CompressT<Fp2> Compress;
1822 f2z.sqru();
1823 f2z.sqru(f6z);
1824 f6z *= f2z;
1825 Compress::fixed_power(f6z2, f6z);
1826 // A variable a is unnecessary only here.
1827 f6z2.sqru(a);
1828 Compress::fixed_power(f12z3, a);
1829 // It will compute inversion of f2z, thus, conjugation free.
1830 Fp6::neg(f6z.b_, f6z.b_);
1831 Fp6::neg(f12z3.b_, f12z3.b_);
1832 // Computes a and b.
1833 Fp12T::mul(a, f12z3, f6z2);
1834 a *= f6z;
1835 Fp12T::mul(b, a, f2z);
1836 // @note f2z, f6z, and f12z are unnecessary from here.
1837 // Last part.
1838 Fp12T::mul(z, a, f6z2);
1839 z *= f;
1840 b.Frobenius(f2z);
1841 z *= f2z;
1842 a.Frobenius2(f2z);
1843 z *= f2z;
1844 Fp6::neg(f.b_, f.b_);
1845 b *= f;
1846 b.Frobenius3(f2z);
1847 z *= f2z;
1848#endif
1849 }
CompressT< Fp2 > Compress
Definition bn.h:2961
void(* CompressT)(CompressT &, int)
Definition bn.h:2345
static void fixed_power(Fp12 &z, const Fp12 &x)
Definition bn.h:2310
void mapToCyclo(Fp12T &z)
Definition bn.h:1731
static void(* mul)(Fp12T &z, const Fp12T &x, const Fp12T &y)
Definition bn.h:1449
Fp12T()
Definition bn.h:1372
static void neg(Fp6T &z, const Fp6T &x)
Definition bn.h:896
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Fp2_2z_add_3x()

template<class T >
void bn::Fp12T< T >::Fp2_2z_add_3x ( Fp2 & z,
const Fp2 & x )
inline

Definition at line 1556 of file bn.h.

1557 {
1558 Fp::_2z_add_3x(z.a_, x.a_);
1559 Fp::_2z_add_3x(z.b_, x.b_);
1560 }
static void _2z_add_3x(Fp &z, const Fp &x)
Definition zm2.h:108
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Frobenius()

template<class T >
void bn::Fp12T< T >::Frobenius ( Fp12T< T > & z) const
inline

Definition at line 1640 of file bn.h.

1641 {
1642 /* this assumes (q-1)/6 is odd */
1643 if (&z != this) {
1644 z.a_.a_.a_ = a_.a_.a_;
1645 z.a_.b_.a_ = a_.b_.a_;
1646 z.a_.c_.a_ = a_.c_.a_;
1647 z.b_.a_.a_ = b_.a_.a_;
1648 z.b_.b_.a_ = b_.b_.a_;
1649 z.b_.c_.a_ = b_.c_.a_;
1650 }
1651 Fp::neg(z.a_.a_.b_, a_.a_.b_);
1652 Fp::neg(z.a_.b_.b_, a_.b_.b_);
1653 Fp::neg(z.a_.c_.b_, a_.c_.b_);
1654 Fp::neg(z.b_.a_.b_, b_.a_.b_);
1655 Fp::neg(z.b_.b_.b_, b_.b_.b_);
1656 Fp::neg(z.b_.c_.b_, b_.c_.b_);
1657#ifdef BN_SUPPORT_SNARK
1658 z.a_.b_ *= Param::gammar[1];
1659 z.a_.c_ *= Param::gammar[3];
1660#else
1661 assert(Param::gammar[1].a_ == 0);
1662 assert(Param::gammar[3].b_ == 0);
1663 Fp2::mul_Fp_1(z.a_.b_, Param::gammar[1].b_);
1664 Fp2::mul_Fp_0(z.a_.c_, z.a_.c_, Param::gammar[3].a_);
1665#endif
1666 z.b_.a_ *= Param::gammar[0];
1667 z.b_.b_ *= Param::gammar[2];
1668 z.b_.c_ *= Param::gammar[4];
1669 }
static void(* neg)(Fp &out, const Fp &x)
Definition zm2.h:92
Fp a_
Definition bn.h:350
static void mul_Fp_1(Fp2T &z, const Fp &y_b)
Definition bn.h:575
static void(* mul_Fp_0)(Fp2T &z, const Fp2T &x, const Fp &b)
Definition bn.h:375
Fp b_
Definition bn.h:350
static Fp2 gammar[5]
Definition bn.h:189
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Frobenius2()

template<class T >
void bn::Fp12T< T >::Frobenius2 ( Fp12T< T > & z) const
inline

Definition at line 1678 of file bn.h.

1679 {
1680#if 0
1681 Frobenius(z);
1682 z.Frobenius(z);
1683#else
1684 if (&z != this) {
1685 z.a_.a_ = a_.a_;
1686 }
1687 z.a_.a_ = a_.a_;
1688 Fp2::mul_Fp_0(z.a_.b_, a_.b_, Param::gammar2[1].a_);
1689 Fp2::mul_Fp_0(z.a_.c_, a_.c_, Param::gammar2[3].a_);
1690 Fp2::mul_Fp_0(z.b_.a_, b_.a_, Param::gammar2[0].a_);
1691 Fp2::mul_Fp_0(z.b_.b_, b_.b_, Param::gammar2[2].a_);
1692 Fp2::mul_Fp_0(z.b_.c_, b_.c_, Param::gammar2[4].a_);
1693#endif
1694 }
void Frobenius(Fp12T &z) const
Definition bn.h:1640
static Fp2 gammar2[5]
Definition bn.h:190
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Frobenius3()

template<class T >
void bn::Fp12T< T >::Frobenius3 ( Fp12T< T > & z) const
inline

Definition at line 1696 of file bn.h.

1697 {
1698#if 0
1699 Frobenius2(z);
1700 z.Frobenius(z);
1701#else
1702 z.a_.a_.a_ = a_.a_.a_;
1703 z.a_.b_.a_ = a_.b_.a_;
1704 z.a_.c_.a_ = a_.c_.a_;
1705 z.b_.a_.a_ = b_.a_.a_;
1706 z.b_.b_.a_ = b_.b_.a_;
1707 z.b_.c_.a_ = b_.c_.a_;
1708 Fp::neg(z.a_.a_.b_, a_.a_.b_);
1709 Fp::neg(z.a_.b_.b_, a_.b_.b_);
1710 Fp::neg(z.a_.c_.b_, a_.c_.b_);
1711 Fp::neg(z.b_.a_.b_, b_.a_.b_);
1712 Fp::neg(z.b_.b_.b_, b_.b_.b_);
1713 Fp::neg(z.b_.c_.b_, b_.c_.b_);
1714
1715#ifdef BN_SUPPORT_SNARK
1716 z.a_.b_ *= Param::gammar3[1];
1717 z.a_.c_ *= Param::gammar3[3];
1718#else
1719 z.a_.b_.mul_x();
1720 Fp2::mul_Fp_0(z.a_.c_, z.a_.c_, Param::gammar3[3].a_);
1721#endif
1722 z.b_.a_ *= Param::gammar3[0];
1723 z.b_.b_ *= Param::gammar3[2];
1724 z.b_.c_ *= Param::gammar3[4];
1725#endif
1726 }
void Frobenius2(Fp12T &z) const
Definition bn.h:1678
static Fp2 gammar3[5]
Definition bn.h:191
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get() [1/2]

template<class T >
Fp * bn::Fp12T< T >::get ( )
inline

Definition at line 1402 of file bn.h.

1402{ return a_.get(); }

◆ get() [2/2]

template<class T >
const Fp * bn::Fp12T< T >::get ( ) const
inline

Definition at line 1403 of file bn.h.

1403{ return a_.get(); }

◆ getFp2() [1/2]

template<class T >
Fp2 * bn::Fp12T< T >::getFp2 ( )
inline

Definition at line 1404 of file bn.h.

1404{ return a_.getFp2(); }
Here is the caller graph for this function:

◆ getFp2() [2/2]

template<class T >
const Fp2 * bn::Fp12T< T >::getFp2 ( ) const
inline

Definition at line 1405 of file bn.h.

1405{ return a_.getFp2(); }

◆ inverse()

template<class T >
void bn::Fp12T< T >::inverse ( )
inline

Definition at line 1620 of file bn.h.

1621 {
1622 Fp6 tmp0;
1623 Fp6 tmp1;
1624 Fp2 tmp2;
1625 Fp6::square(tmp0, a_);
1626 Fp6::square(tmp1, b_);
1627 Fp2::mul_xi(tmp2, tmp1.c_);
1628 tmp0.a_ -= tmp2;
1629 tmp0.b_ -= tmp1.a_;
1630 tmp0.c_ -= tmp1.b_;
1631 tmp0.inverse();
1632 Fp6::mul(a_, a_, tmp0);
1633 Fp6::mul(b_, b_, tmp0);
1634 Fp6::neg(b_, b_);
1635 }
T Fp6
Definition bn.h:1364
static void(* mul_xi)(Fp2T &z, const Fp2T &x)
Definition bn.h:374
static void square(Fp6T &z, const Fp6T &x)
Definition bn.h:914
static void(* mul)(Fp6T &z, const Fp6T &x, const Fp6T &y)
Definition bn.h:984
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isZero()

template<class T >
bool bn::Fp12T< T >::isZero ( ) const
inline

Definition at line 1412 of file bn.h.

1413 {
1414 return a_.isZero() && b_.isZero();
1415 }

◆ mapToCyclo()

template<class T >
void bn::Fp12T< T >::mapToCyclo ( Fp12T< T > & z)
inline

Definition at line 1731 of file bn.h.

1732 {
1733 // (a + b*i) -> ((a - b*i) * (a + b*i)^(-1))^(q^2+1)
1734 //
1735 // See Beuchat page 9: raising to 6-th power is the same as
1736 // conjugation, so this entire function computes
1737 // z^((p^6-1) * (p^2+1))
1738 z.a_ = a_;
1739 Fp6::neg(z.b_, b_);
1740 inverse();
1741 z *= *this;
1742 z.Frobenius2(*this);
1743 z *= *this;
1744 }
void inverse()
Definition bn.h:1620
Here is the call graph for this function:
Here is the caller graph for this function:

◆ mulC()

template<class T >
static void bn::Fp12T< T >::mulC ( Fp12T< T > & z,
const Fp12T< T > & x,
const Fp12T< T > & y )
inlinestatic

Definition at line 1450 of file bn.h.

1451 {
1452 Dbl zd;
1453 Fp6 t0, t1;
1454 Fp6Dbl T0, T1, T2;
1455 // # 1
1456 Fp6Dbl::mul(T0, x.a_, y.a_);
1457 Fp6Dbl::mul(T1, x.b_, y.b_);
1458 Fp6::add(t0, x.a_, x.b_);
1459 Fp6::add(t1, y.a_, y.b_);
1460 // # 2
1461 Fp6Dbl::mul(zd.a_, t0, t1);
1462 // # 3
1463 Fp6Dbl::add(T2, T0, T1);
1464 // # 4
1465 Fp6Dbl::sub(zd.b_, zd.a_, T2);
1466 // #6, 7, 8
1467 mul_gamma_add<Fp6Dbl, Fp2Dbl>(zd.a_, T1, T0);
1468 Dbl::mod(z, zd);
1469 }
void mul_gamma_add(F &z, const F &x, const F &y)
Definition bn.h:333
static void mod(Fp12T &z, Dbl &x)
Definition bn.h:2110
Fp6::Dbl Fp6Dbl
Definition bn.h:1369
static void sub(Dbl &z, const Dbl &x, const Dbl &y)
Definition bn.h:1249
static void(* mul)(Dbl &, const Fp6T &x, const Fp6T &y)
Definition bn.h:1262
static void add(Dbl &z, const Dbl &x, const Dbl &y)
Definition bn.h:1228
Here is the call graph for this function:

◆ neg()

template<class T >
static void bn::Fp12T< T >::neg ( Fp12T< T > & z,
const Fp12T< T > & x )
inlinestatic

Definition at line 1442 of file bn.h.

1443 {
1444 Fp6::neg(z.a_, x.a_);
1445 Fp6::neg(z.b_, x.b_);
1446 }
Here is the call graph for this function:

◆ operator!=()

template<class T >
bool bn::Fp12T< T >::operator!= ( const Fp12T< T > & rhs) const
inline

Definition at line 1420 of file bn.h.

1420{ return !operator==(rhs); }
bool operator==(const Fp12T &rhs) const
Definition bn.h:1416
Here is the call graph for this function:

◆ operator==()

template<class T >
bool bn::Fp12T< T >::operator== ( const Fp12T< T > & rhs) const
inline

Definition at line 1416 of file bn.h.

1417 {
1418 return a_ == rhs.a_ && b_ == rhs.b_;
1419 }
Here is the caller graph for this function:

◆ set()

template<class T >
void bn::Fp12T< T >::set ( const Fp2 & v0,
const Fp2 & v1,
const Fp2 & v2,
const Fp2 & v3,
const Fp2 & v4,
const Fp2 & v5 )
inline

Definition at line 1406 of file bn.h.

1407 {
1408 a_.set(v0, v1, v2);
1409 b_.set(v3, v4, v5);
1410 }

◆ sq_Fp4UseDbl()

template<class T >
static void bn::Fp12T< T >::sq_Fp4UseDbl ( Fp2 & z0,
Fp2 & z1,
const Fp2 & x0,
const Fp2 & x1 )
inlinestatic

Definition at line 1509 of file bn.h.

1510 {
1511 Fp2Dbl T0, T1, T2;
1512 Fp2Dbl::square(T0, x0);
1513 Fp2Dbl::square(T1, x1);
1514 Fp2Dbl::mul_xi(T2, T1);
1515 T2 += T0;
1516 Fp2::add(z1, x0, x1);
1517 Fp2Dbl::mod(z0, T2);
1518 // overwrite z[0] (position 0).
1519 Fp2Dbl::square(T2, z1);
1520 T2 -= T0;
1521 T2 -= T1;
1522 Fp2Dbl::mod(z1, T2);
1523 }
Fp2::Dbl Fp2Dbl
Definition bn.h:1368
static void(* mod)(Fp2T &z, const Dbl &x)
Definition bn.h:660
static uni_op * mul_xi
Definition bn.h:662
static void(* square)(Dbl &z, const Fp2T &x)
Definition bn.h:659
static void(* add)(Fp2T &z, const Fp2T &x, const Fp2T &y)
Definition bn.h:368
Here is the caller graph for this function:

◆ sqru() [1/2]

template<class T >
void bn::Fp12T< T >::sqru ( )
inline

Definition at line 1561 of file bn.h.

1562 {
1563 Fp2& z0(a_.a_);
1564 Fp2& z4(a_.b_);
1565 Fp2& z3(a_.c_);
1566 Fp2& z2(b_.a_);
1567 Fp2& z1(b_.b_);
1568 Fp2& z5(b_.c_);
1569 Fp2 t0, t1;
1570 sq_Fp4UseDbl(t0, t1, z0, z1); // a^2 = t0 + t1*y
1571 // For A
1572 Fp2::sub(z0, t0, z0);
1573 z0 += z0;
1574 z0 += t0;
1575#if 0
1576 Fp2_2z_add_3x(z1, t1);
1577#else
1578 Fp2::add(z1, t1, z1);
1579 z1 += z1;
1580 z1 += t1;
1581#endif
1582 // t0 and t1 are unnecessary from here.
1583 Fp2 t2, t3;
1584 sq_Fp4UseDbl(t0, t1, z2, z3); // b^2 = t0 + t1*y
1585 sq_Fp4UseDbl(t2, t3, z4, z5); // c^2 = t2 + t3*y
1586 // For C
1587 Fp2::sub(z4, t0, z4);
1588 z4 += z4;
1589 z4 += t0;
1590#if 0
1591 Fp2_2z_add_3x(z5, t1);
1592#else
1593 Fp2::add(z5, t1, z5);
1594 z5 += z5;
1595 z5 += t1;
1596#endif
1597 // For B
1598 Fp2::mul_xi(t0, t3);
1599#if 0
1600 Fp2_2z_add_3x(z2, t0);
1601#else
1602 Fp2::add(z2, t0, z2);
1603 z2 += z2;
1604 z2 += t0;
1605#endif
1606 Fp2::sub(z3, t2, z3);
1607 z3 += z3;
1608 z3 += t2;
1609 }
static void sq_Fp4UseDbl(Fp2 &z0, Fp2 &z1, const Fp2 &x0, const Fp2 &x1)
Definition bn.h:1509
void Fp2_2z_add_3x(Fp2 &z, const Fp2 &x)
Definition bn.h:1556
static void(* sub)(Fp2T &z, const Fp2T &x, const Fp2T &y)
Definition bn.h:370
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sqru() [2/2]

template<class T >
void bn::Fp12T< T >::sqru ( Fp12T< T > & zz) const
inline

Definition at line 1614 of file bn.h.

1615 {
1616 zz = *this;
1617 zz.sqru();
1618 }
Here is the call graph for this function:

◆ squareC()

template<class T >
static void bn::Fp12T< T >::squareC ( Fp12T< T > & z)
inlinestatic

Definition at line 1476 of file bn.h.

1477 {
1478 Fp6 t0, t1;
1479 // # 1, 2
1480 Fp6::add(t0, z.a_, z.b_);
1481 // b_.mul_gamma(t1); t1 += a_; # 3
1482 mul_gamma_add<Fp6, Fp2>(t1, z.b_, z.a_);
1483 // # 4
1484 z.b_ *= z.a_;
1485 Fp6::mul(z.a_, t0, t1);
1486 // # 5, 6, 7 @note It's typo.
1487 mul_gamma_add<Fp6, Fp2>(t1, z.b_, z.b_);
1488 // # 8
1489 z.a_ -= t1;
1490 z.b_ += z.b_;
1491 }
Here is the call graph for this function:

◆ sub()

template<class T >
static void bn::Fp12T< T >::sub ( Fp12T< T > & z,
const Fp12T< T > & x,
const Fp12T< T > & y )
inlinestatic

Definition at line 1437 of file bn.h.

1438 {
1439 Fp6::sub(z.a_, x.a_, y.a_);
1440 Fp6::sub(z.b_, x.b_, y.b_);
1441 }
static void(* sub)(Fp6T &z, const Fp6T &x, const Fp6T &y)
Definition bn.h:983
Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ operator<<

template<class T >
std::ostream & operator<< ( std::ostream & os,
const Fp12T< T > & x )
friend

Definition at line 1421 of file bn.h.

1422 {
1423 return os << "[" << x.a_ << ",\n " << x.b_ << "]";
1424 }
os_t os

◆ operator>>

template<class T >
std::istream & operator>> ( std::istream & is,
Fp12T< T > & x )
friend

Definition at line 1425 of file bn.h.

1426 {
1427 char c1, c2, c3;
1428 is >> c1 >> x.a_ >> c2 >> x.b_ >> c3;
1429 if (c1 == '[' && c2 == ',' && c3 == ']') return is;
1430 throw std::ios_base::failure("bad Fp12");
1431 }

Member Data Documentation

◆ a_

template<class T >
Fp6 bn::Fp12T< T >::a_

Definition at line 1371 of file bn.h.

◆ b_

template<class T >
Fp6 bn::Fp12T< T >::b_

Definition at line 1371 of file bn.h.

◆ mul

template<class T >
void(* bn::Fp12T< T >::mul) (Fp12T &z, const Fp12T &x, const Fp12T &y)
static

Definition at line 1449 of file bn.h.

◆ square

template<class T >
void(* bn::Fp12T< T >::square) (Fp12T &z)
static

Definition at line 1475 of file bn.h.


The documentation for this struct was generated from the following file: