Crypto++
5.6.4
Free C++ class library of cryptographic schemes
|
Go to the documentation of this file.
24 : identity(
false), x(x), y(y) {}
27 {
return (identity && t.identity) || (!identity && !t.identity && x==t.x && y==t.y);}
29 {
return identity ? !t.identity : (!t.identity && (x<t.x || (x==t.x && y<t.y)));}
31 #ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
50 ECP(
const ECP &ecp,
bool convertToMontgomeryRepresentation =
false);
52 : m_fieldPtr(
new Field(modulus)), m_a(a.IsNegative() ? modulus+a : a), m_b(b) {}
76 bool VerifyPoint(
const Point &P)
const;
78 unsigned int EncodedPointSize(
bool compressed =
false)
const
79 {
return 1 + (compressed?1:2)*GetField().MaxElementByteLength();}
82 bool DecodePoint(
Point &P,
const byte *encodedPoint,
size_t len)
const;
83 void EncodePoint(
byte *encodedPoint,
const Point &P,
bool compressed)
const;
89 Integer FieldSize()
const {
return GetField().GetModulus();}
90 const Field & GetField()
const {
return *m_fieldPtr;}
95 {
return GetField() == rhs.GetField() && m_a == rhs.m_a && m_b == rhs.m_b;}
97 #ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
119 bool NeedConversions()
const {
return true;}
121 {
return P.identity ? P :
ECP::Point(m_ec->GetField().ConvertIn(P.x), m_ec->GetField().ConvertIn(P.y));};
123 {
return P.identity ? P :
ECP::Point(m_ec->GetField().ConvertOut(P.x), m_ec->GetField().ConvertOut(P.y));}
129 void SetCurve(
const ECP &ec)
131 m_ec.reset(
new ECP(ec,
true));
134 const ECP & GetCurve()
const {
return *m_ecOriginal;}
136 #ifndef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY_562
virtual Element ScalarMultiply(const Element &a, const Integer &e) const
Performs a scalar multiplication.
Elliptic Curve over GF(p), where p is prime.
virtual bool Equal(const Element &a, const Element &b) const =0
Compare two elements for equality.
Ring of congruence classes modulo n.
Classes for automatic resource management.
This file contains helper classes/functions for implementing public key algorithms.
Class file for performing modular arithmetic.
bool operator<(const OID &lhs, const OID &rhs)
Compare two OIDs for ordering.
Interface for random number generators.
virtual const Element & Identity() const =0
Provides the Identity element.
bool operator==(const OID &lhs, const OID &rhs)
Compare two OIDs for equality.
virtual Element CascadeScalarMultiply(const Element &x, const Integer &e1, const Element &y, const Integer &e2) const
TODO.
Classes for precomputation in a group.
A pointer which can be copied and cloned.
virtual const Element & Double(const Element &a) const
Doubles an element in the group.
Classes for performing mathematics over different fields.
Crypto++ library namespace.
virtual void SimultaneousMultiply(Element *results, const Element &base, const Integer *exponents, unsigned int exponentsCount) const
Multiplies a base to multiple exponents in a group.
virtual const Element & Inverse(const Element &a) const =0
Inverts the element in the group.
virtual const Element & Add(const Element &a, const Element &b) const =0
Adds elements in the group.
Abstract base classes that provide a uniform interface to this library.
Multiple precision integer with arithmetic operations.
virtual bool InversionIsFast() const
Determine if inversion is fast.
Multiple precision integer with arithmetic operations.