Fabcoin Core  0.16.2
P2P Digital Currency
Public Types | Public Member Functions | Private Attributes | List of all members
EC2N Class Reference

Elliptic Curve over GF(2^n) More...

#include <ec2n.h>

Inheritance diagram for EC2N:
[legend]
Collaboration diagram for EC2N:
[legend]

Public Types

typedef GF2NP Field
 
typedef Field::Element FieldElement
 
typedef EC2NPoint Point
 
- Public Types inherited from AbstractGroup< EC2NPoint >
typedef EC2NPoint Element
 

Public Member Functions

virtual ~EC2N ()
 
 EC2N ()
 Construct an EC2N. More...
 
 EC2N (const Field &field, const Field::Element &a, const Field::Element &b)
 Construct an EC2N. More...
 
 EC2N (BufferedTransformation &bt)
 Construct an EC2N from BER encoded parameters. More...
 
void DEREncode (BufferedTransformation &bt) const
 Encode the fields fieldID and curve of the sequence ECParameters. More...
 
bool Equal (const Point &P, const Point &Q) const
 Compare two elements for equality. More...
 
const PointIdentity () const
 Provides the Identity element. More...
 
const PointInverse (const Point &P) const
 Inverts the element in the group. More...
 
bool InversionIsFast () const
 Determine if inversion is fast. More...
 
const PointAdd (const Point &P, const Point &Q) const
 Adds elements in the group. More...
 
const PointDouble (const Point &P) const
 Doubles an element in the group. More...
 
Point Multiply (const Integer &k, const Point &P) const
 
Point CascadeMultiply (const Integer &k1, const Point &P, const Integer &k2, const Point &Q) const
 
bool ValidateParameters (RandomNumberGenerator &rng, unsigned int level=3) const
 
bool VerifyPoint (const Point &P) const
 Verifies points on elliptic curve. More...
 
unsigned int EncodedPointSize (bool compressed=false) const
 Determines encoded point size. More...
 
bool DecodePoint (Point &P, BufferedTransformation &bt, size_t len) const
 Decodes an elliptic curve point. More...
 
bool DecodePoint (Point &P, const byte *encodedPoint, size_t len) const
 Decodes an elliptic curve point. More...
 
void EncodePoint (byte *encodedPoint, const Point &P, bool compressed) const
 Encodes an elliptic curve point. More...
 
void EncodePoint (BufferedTransformation &bt, const Point &P, bool compressed) const
 Encodes an elliptic curve point. More...
 
Point BERDecodePoint (BufferedTransformation &bt) const
 BER Decodes an elliptic curve point. More...
 
void DEREncodePoint (BufferedTransformation &bt, const Point &P, bool compressed) const
 DER Encodes an elliptic curve point. More...
 
Integer FieldSize () const
 
const FieldGetField () const
 
const FieldElementGetA () const
 
const FieldElementGetB () const
 
bool operator== (const EC2N &rhs) const
 
- Public Member Functions inherited from AbstractGroup< EC2NPoint >
virtual ~AbstractGroup ()
 
virtual const ElementSubtract (const Element &a, const Element &b) const
 Subtracts elements in the group. More...
 
virtual ElementAccumulate (Element &a, const Element &b) const
 TODO. More...
 
virtual ElementReduce (Element &a, const Element &b) const
 Reduces an element in the congruence class. More...
 
virtual Element ScalarMultiply (const Element &a, const Integer &e) const
 Performs a scalar multiplication. More...
 
virtual Element CascadeScalarMultiply (const Element &x, const Integer &e1, const Element &y, const Integer &e2) const
 TODO. More...
 
virtual void SimultaneousMultiply (Element *results, const Element &base, const Integer *exponents, unsigned int exponentsCount) const
 Multiplies a base to multiple exponents in a group. More...
 
- Public Member Functions inherited from EncodedPoint< EC2NPoint >
virtual ~EncodedPoint ()
 

Private Attributes

clonable_ptr< Fieldm_field
 
FieldElement m_a
 
FieldElement m_b
 
Point m_R
 

Detailed Description

Elliptic Curve over GF(2^n)

Definition at line 24 of file ec2n.h.

Member Typedef Documentation

typedef GF2NP EC2N::Field

Definition at line 27 of file ec2n.h.

Definition at line 28 of file ec2n.h.

Definition at line 29 of file ec2n.h.

Constructor & Destructor Documentation

virtual EC2N::~EC2N ( )
inlinevirtual

Definition at line 31 of file ec2n.h.

EC2N::EC2N ( )
inline

Construct an EC2N.

Definition at line 34 of file ec2n.h.

EC2N::EC2N ( const Field field,
const Field::Element a,
const Field::Element b 
)
inline

Construct an EC2N.

Parameters
fieldField, GF2NP derived class
aField::Element
bField::Element

Definition at line 40 of file ec2n.h.

EC2N::EC2N ( BufferedTransformation bt)

Construct an EC2N from BER encoded parameters.

Parameters
btBufferedTransformation derived object

This constructor will decode and extract the the fields fieldID and curve of the sequence ECParameters

Definition at line 16 of file ec2n.cpp.

Here is the call graph for this function:

Member Function Documentation

const EC2N::Point & EC2N::Add ( const Point a,
const Point b 
) const
virtual

Adds elements in the group.

Parameters
afirst element
bsecond element
Returns
the sum of a and b

Implements AbstractGroup< EC2NPoint >.

Definition at line 196 of file ec2n.cpp.

Here is the call graph for this function:

EC2N::Point EC2N::BERDecodePoint ( BufferedTransformation bt) const
virtual

BER Decodes an elliptic curve point.

Parameters
btsource BufferedTransformation
Returns
the decoded elliptic curve point

Implements EncodedPoint< EC2NPoint >.

Definition at line 125 of file ec2n.cpp.

Here is the call graph for this function:

Point EC2N::CascadeMultiply ( const Integer k1,
const Point P,
const Integer k2,
const Point Q 
) const
inline

Definition at line 61 of file ec2n.h.

bool EC2N::DecodePoint ( EC2N::Point P,
BufferedTransformation bt,
size_t  len 
) const
virtual

Decodes an elliptic curve point.

Parameters
Ppoint which is decoded
btsource BufferedTransformation
lennumber of bytes to read from the BufferedTransformation
Returns
true if a point was decoded, false otherwise

Implements EncodedPoint< EC2NPoint >.

Definition at line 47 of file ec2n.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool EC2N::DecodePoint ( EC2N::Point P,
const byte encodedPoint,
size_t  len 
) const
virtual

Decodes an elliptic curve point.

Parameters
Ppoint which is decoded
encodedPointbyte array with the encoded point
lenthe size of the array
Returns
true if a point was decoded, false otherwise

Implements EncodedPoint< EC2NPoint >.

Definition at line 41 of file ec2n.cpp.

Here is the call graph for this function:

void EC2N::DEREncode ( BufferedTransformation bt) const

Encode the fields fieldID and curve of the sequence ECParameters.

Parameters
btBufferedTransformation derived object

Definition at line 32 of file ec2n.cpp.

Here is the call graph for this function:

void EC2N::DEREncodePoint ( BufferedTransformation bt,
const Point P,
bool  compressed 
) const
virtual

DER Encodes an elliptic curve point.

Parameters
bttarget BufferedTransformation
Ppoint which is encoded
compressedflag indicating if the point is compressed

Implements EncodedPoint< EC2NPoint >.

Definition at line 135 of file ec2n.cpp.

Here is the call graph for this function:

const EC2N::Point & EC2N::Double ( const Point a) const
virtual

Doubles an element in the group.

Parameters
athe element
Returns
the element doubled

Reimplemented from AbstractGroup< EC2NPoint >.

Definition at line 218 of file ec2n.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

unsigned int EC2N::EncodedPointSize ( bool  compressed = false) const
inlinevirtual

Determines encoded point size.

Parameters
compressedflag indicating if the point is compressed
Returns
the minimum number of bytes required to encode the point

Implements EncodedPoint< EC2NPoint >.

Definition at line 67 of file ec2n.h.

Here is the caller graph for this function:

void EC2N::EncodePoint ( byte encodedPoint,
const Point P,
bool  compressed 
) const
virtual

Encodes an elliptic curve point.

Parameters
Ppoint which is decoded
encodedPointbyte array for the encoded point
compressedflag indicating if the point is compressed

encodedPoint must be at least EncodedPointSize() in length

Implements EncodedPoint< EC2NPoint >.

Definition at line 118 of file ec2n.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void EC2N::EncodePoint ( BufferedTransformation bt,
const Point P,
bool  compressed 
) const
virtual

Encodes an elliptic curve point.

Parameters
bttarget BufferedTransformation
Ppoint which is encoded
compressedflag indicating if the point is compressed

Implements EncodedPoint< EC2NPoint >.

Definition at line 100 of file ec2n.cpp.

Here is the call graph for this function:

bool EC2N::Equal ( const Point a,
const Point b 
) const
virtual

Compare two elements for equality.

Parameters
afirst element
bsecond element
Returns
true if the elements are equal, false otherwise

Equal() tests the elements for equality using a==b

Implements AbstractGroup< EC2NPoint >.

Definition at line 164 of file ec2n.cpp.

Here is the caller graph for this function:

Integer EC2N::FieldSize ( ) const
inline

Definition at line 78 of file ec2n.h.

Here is the call graph for this function:

const FieldElement& EC2N::GetA ( ) const
inline

Definition at line 80 of file ec2n.h.

const FieldElement& EC2N::GetB ( ) const
inline

Definition at line 81 of file ec2n.h.

const Field& EC2N::GetField ( ) const
inline

Definition at line 79 of file ec2n.h.

Here is the caller graph for this function:

const EC2N::Point & EC2N::Identity ( ) const
virtual

Provides the Identity element.

Returns
the Identity element

Implements AbstractGroup< EC2NPoint >.

Definition at line 178 of file ec2n.cpp.

Here is the caller graph for this function:

const EC2N::Point & EC2N::Inverse ( const Point a) const
virtual

Inverts the element in the group.

Parameters
afirst element
Returns
the inverse of the element

Implements AbstractGroup< EC2NPoint >.

Definition at line 183 of file ec2n.cpp.

bool EC2N::InversionIsFast ( ) const
inlinevirtual

Determine if inversion is fast.

Returns
true if inversion is fast, false otherwise

Reimplemented from AbstractGroup< EC2NPoint >.

Definition at line 55 of file ec2n.h.

Here is the call graph for this function:

Point EC2N::Multiply ( const Integer k,
const Point P 
) const
inline

Definition at line 59 of file ec2n.h.

Here is the caller graph for this function:

bool EC2N::operator== ( const EC2N rhs) const
inline

Definition at line 83 of file ec2n.h.

Here is the call graph for this function:

bool EC2N::ValidateParameters ( RandomNumberGenerator rng,
unsigned int  level = 3 
) const

Definition at line 142 of file ec2n.cpp.

bool EC2N::VerifyPoint ( const Point P) const
virtual

Verifies points on elliptic curve.

Parameters
Ppoint to verify
Returns
true if the point is valid, false otherwise

Implements EncodedPoint< EC2NPoint >.

Definition at line 155 of file ec2n.cpp.

Member Data Documentation

FieldElement EC2N::m_a
private

Definition at line 88 of file ec2n.h.

FieldElement EC2N::m_b
private

Definition at line 88 of file ec2n.h.

clonable_ptr<Field> EC2N::m_field
private

Definition at line 87 of file ec2n.h.

Point EC2N::m_R
mutableprivate

Definition at line 89 of file ec2n.h.


The documentation for this class was generated from the following files: