38 ECP(
const ECP &ecp,
bool convertToMontgomeryRepresentation =
false);
44 ECP(
const Integer &modulus,
const FieldElement &
a,
const FieldElement &
b)
45 : m_fieldPtr(new Field(modulus)), m_a(a.IsNegative() ? modulus+a : a), m_b(b) {}
56 bool Equal(
const Point &
P,
const Point &
Q)
const;
57 const Point& Identity()
const;
58 const Point& Inverse(
const Point &P)
const;
60 const Point&
Add(
const Point &P,
const Point &Q)
const;
61 const Point& Double(
const Point &P)
const;
62 Point ScalarMultiply(
const Point &P,
const Integer &k)
const;
63 Point CascadeScalarMultiply(
const Point &P,
const Integer &
k1,
const Point &Q,
const Integer &
k2)
const;
64 void SimultaneousMultiply(Point *results,
const Point &base,
const Integer *exponents,
unsigned int exponentsCount)
const;
67 {
return ScalarMultiply(P, k);}
69 {
return CascadeScalarMultiply(P, k1, Q, k2);}
72 bool VerifyPoint(
const Point &P)
const;
75 {
return 1 + (compressed?1:2)*
GetField().MaxElementByteLength();}
78 bool DecodePoint(Point &P,
const byte *encodedPoint,
size_t len)
const;
79 void EncodePoint(
byte *encodedPoint,
const Point &P,
bool compressed)
const;
86 const Field &
GetField()
const {
return *m_fieldPtr;}
87 const FieldElement &
GetA()
const {
return m_a;}
88 const FieldElement &
GetB()
const {
return m_b;}
95 FieldElement m_a,
m_b;
122 {
return P.
identity ? P :
ECP::Point(m_ec->GetField().ConvertIn(P.
x), m_ec->GetField().ConvertIn(P.
y));};
124 {
return P.
identity ? P :
ECP::Point(m_ec->GetField().ConvertOut(P.
x), m_ec->GetField().ConvertOut(P.
y));}
132 m_ec.reset(
new ECP(ec,
true));
bool operator==(const ECP &rhs) const
bool GetField(std::istream &is, std::string &name, std::string &value)
Element ConvertIn(const Element &P) const
Elliptical Curve Point over GF(p), where p is prime.
bool InversionIsFast() const
Determine if inversion is fast.
Elliptic Curve over GF(p), where p is prime.
#define NAMESPACE_BEGIN(x)
#define CRYPTOPP_DLL_TEMPLATE_CLASS
const FieldElement & GetA() const
Abstract base classes that provide a uniform interface to this library.
void DEREncodeElement(BufferedTransformation &bt, const Element &v) const
Classes for automatic resource management.
unsigned int EncodedPointSize(bool compressed=false) const
Determines encoded point size.
Ring of congruence classes modulo n.
Interface for random number generators.
int Add(word *C, const word *A, const word *B, size_t N)
Classes for Elliptic Curve points.
Classes for performing mathematics over different fields.
virtual ~EcPrecomputation()
const AbstractGroup< Element > & GetGroup() const
Element BERDecodeElement(BufferedTransformation &bt) const
const ECP & GetCurve() const
A pointer which can be copied and cloned.
Multiple precision integer with arithmetic operations.
clonable_ptr< Field > m_fieldPtr
const FieldElement & GetB() const
Integer FieldSize() const
Element ConvertOut(const Element &P) const
Classes for precomputation in a group.
Abstract class for encoding and decoding ellicptic curve points.
Elliptic Curve precomputation.
Multiple precision integer with arithmetic operations.
Class file for performing modular arithmetic.
const Field & GetField() const
value_ptr< ECP > m_ecOriginal
ECP(const Integer &modulus, const FieldElement &a, const FieldElement &b)
Construct an ECP.
bool NeedConversions() const
void SetCurve(const ECP &ec)
Point CascadeMultiply(const Integer &k1, const Point &P, const Integer &k2, const Point &Q) const
Point Multiply(const Integer &k, const Point &P) const