Crypto++
8.6
Free C++ class library of cryptographic schemes
|
Go to the documentation of this file.
6 #ifndef CRYPTOPP_EC2N_H
7 #define CRYPTOPP_EC2N_H
18 #if CRYPTOPP_MSC_VERSION
19 # pragma warning(push)
20 # pragma warning(disable: 4231 4275)
30 typedef Field::Element FieldElement;
42 EC2N(
const Field &field,
const Field::Element &a,
const Field::Element &b)
43 : m_field(field), m_a(a), m_b(b) {}
54 bool Equal(
const Point &P,
const Point &Q)
const;
55 const Point& Identity()
const;
56 const Point& Inverse(
const Point &P)
const;
57 bool InversionIsFast()
const {
return true;}
58 const Point& Add(
const Point &P,
const Point &Q)
const;
59 const Point& Double(
const Point &P)
const;
61 Point Multiply(
const Integer &k,
const Point &P)
const
62 {
return ScalarMultiply(P, k);}
63 Point CascadeMultiply(
const Integer &k1,
const Point &P,
const Integer &k2,
const Point &Q)
const
64 {
return CascadeScalarMultiply(P, k1, Q, k2);}
67 bool VerifyPoint(
const Point &P)
const;
70 {
return 1 + (compressed?1:2)*m_field->MaxElementByteLength();}
73 bool DecodePoint(Point &P,
const byte *encodedPoint,
size_t len)
const;
74 void EncodePoint(
byte *encodedPoint,
const Point &P,
bool compressed)
const;
81 const Field & GetField()
const {
return *m_field;}
82 const FieldElement & GetA()
const {
return m_a;}
83 const FieldElement & GetB()
const {
return m_b;}
86 {
return GetField() == rhs.GetField() && m_a == rhs.m_a && m_b == rhs.m_b;}
90 FieldElement m_a, m_b;
132 #if CRYPTOPP_MSC_VERSION
133 # pragma warning(pop)
static Integer Power2(size_t e)
Exponentiates to a power of 2.
EC2N(const Field &field, const Field::Element &a, const Field::Element &b)
Construct an EC2N.
Classes and functions for schemes over GF(2^n)
Abstract class for encoding and decoding ellicptic curve points.
Elliptic Curve over GF(2^n)
Classes for automatic resource management.
This file contains helper classes/functions for implementing public key algorithms.
Elliptical Curve Point over GF(2^n)
Interface for random number generators.
const EC2N & GetCurve() const
Get the elliptic curve.
bool operator==(const OID &lhs, const OID &rhs)
Compare two OIDs for equality.
Elliptic Curve precomputation.
Classes for precomputation in a group.
void SetCurve(const EC2N &ec)
Set the elliptic curve.
GF(2^n) with Polynomial Basis.
Element BERDecodeElement(BufferedTransformation &bt) const
Decodes element in DER format.
A pointer which can be copied and cloned.
DL_FixedBasePrecomputation adapter class.
void DEREncodeElement(BufferedTransformation &bt, const Element &v) const
Encodes element in DER format.
Classes for performing mathematics over different fields.
Crypto++ library namespace.
#define CRYPTOPP_DLL_TEMPLATE_CLASS
Instantiate templates in a dynamic library.
Classes for Elliptic Curve points.
unsigned int EncodedPointSize(bool compressed=false) const
Determines encoded point size.
Abstract base classes that provide a uniform interface to this library.
Multiple precision integer with arithmetic operations.
Multiple precision integer with arithmetic operations.