7 #ifndef CRYPTOPP_EC2N_H 8 #define CRYPTOPP_EC2N_H 19 #if CRYPTOPP_MSC_VERSION 20 # pragma warning(push) 21 # pragma warning(disable: 4231 4275) 31 typedef Field::Element FieldElement;
43 EC2N(
const Field &field,
const Field::Element &a,
const Field::Element &b)
44 : m_field(field), m_a(a), m_b(b) {}
55 bool Equal(
const Point &P,
const Point &Q)
const;
57 const Point& Inverse(
const Point &P)
const;
59 const Point& Add(
const Point &P,
const Point &Q)
const;
60 const Point& Double(
const Point &P)
const;
62 Point Multiply(
const Integer &k,
const Point &P)
const 63 {
return ScalarMultiply(P, k);}
64 Point CascadeMultiply(
const Integer &k1,
const Point &P,
const Integer &k2,
const Point &Q)
const 65 {
return CascadeScalarMultiply(P, k1, Q, k2);}
68 bool VerifyPoint(
const Point &P)
const;
71 {
return 1 + (compressed?1:2)*m_field->MaxElementByteLength();}
74 bool DecodePoint(Point &P,
const byte *encodedPoint,
size_t len)
const;
75 void EncodePoint(byte *encodedPoint,
const Point &P,
bool compressed)
const;
82 const Field & GetField()
const {
return *m_field;}
83 const FieldElement & GetA()
const {
return m_a;}
84 const FieldElement & GetB()
const {
return m_b;}
87 {
return GetField() == rhs.GetField() && m_a == rhs.m_a && m_b == rhs.m_b;}
91 FieldElement m_a, m_b;
133 #if CRYPTOPP_MSC_VERSION 134 # pragma warning(pop) Element BERDecodeElement(BufferedTransformation &bt) const
Decodes element in DER format.
This file contains helper classes/functions for implementing public key algorithms.
const AbstractGroup< Element > & GetGroup() const
Retrieves AbstractGroup interface.
const char * Identity()
ConstByteArrayParameter.
unsigned int EncodedPointSize(bool compressed=false) const
Determines encoded point size.
Abstract base classes that provide a uniform interface to this library.
Classes for automatic resource management.
Interface for random number generators.
bool InversionIsFast() const
Determine if inversion is fast.
Classes for Elliptic Curve points.
Classes for performing mathematics over different fields.
bool operator==(const OID &lhs, const OID &rhs)
Compare two OIDs for equality.
void SetCurve(const EC2N &ec)
Set the elliptic curve.
EC2N(const Field &field, const Field::Element &a, const Field::Element &b)
Construct an EC2N.
A pointer which can be copied and cloned.
static Integer Power2(size_t e)
Exponentiates to a power of 2.
Multiple precision integer with arithmetic operations.
Elliptic Curve over GF(2^n)
Classes and functions for schemes over GF(2^n)
Classes for precomputation in a group.
GF(2^n) with Polynomial Basis.
Abstract class for encoding and decoding ellicptic curve points.
Elliptic Curve precomputation.
Multiple precision integer with arithmetic operations.
const EC2N & GetCurve() const
Get the elliptic curve.
Crypto++ library namespace.
Elliptical Curve Point over GF(2^n)
DL_FixedBasePrecomputation adapter class.
void DEREncodeElement(BufferedTransformation &bt, const Element &v) const
Encodes element in DER format.