Crypto++
Public Types | Public Member Functions | Static Public Attributes | Protected Attributes
ModularArithmetic Class Reference

ring of congruence classes modulo n More...

#include <modarith.h>

Inheritance diagram for ModularArithmetic:
AbstractRing< Integer > AbstractGroup< Integer > MontgomeryRepresentation

List of all members.

Public Types

typedef int RandomizationParameter
typedef Integer Element

Public Member Functions

 ModularArithmetic (const Integer &modulus=Integer::One())
 ModularArithmetic (const ModularArithmetic &ma)
 ModularArithmetic (BufferedTransformation &bt)
virtual ModularArithmetic * Clone () const
void DEREncode (BufferedTransformation &bt) const
void DEREncodeElement (BufferedTransformation &out, const Element &a) const
void BERDecodeElement (BufferedTransformation &in, Element &a) const
const Integer & GetModulus () const
void SetModulus (const Integer &newModulus)
virtual bool IsMontgomeryRepresentation () const
virtual Integer ConvertIn (const Integer &a) const
virtual Integer ConvertOut (const Integer &a) const
const Integer & Half (const Integer &a) const
bool Equal (const Integer &a, const Integer &b) const
const Integer & Identity () const
const Integer & Add (const Integer &a, const Integer &b) const
Integer & Accumulate (Integer &a, const Integer &b) const
const Integer & Inverse (const Integer &a) const
const Integer & Subtract (const Integer &a, const Integer &b) const
Integer & Reduce (Integer &a, const Integer &b) const
const Integer & Double (const Integer &a) const
const Integer & MultiplicativeIdentity () const
const Integer & Multiply (const Integer &a, const Integer &b) const
const Integer & Square (const Integer &a) const
bool IsUnit (const Integer &a) const
const Integer & MultiplicativeInverse (const Integer &a) const
const Integer & Divide (const Integer &a, const Integer &b) const
Integer CascadeExponentiate (const Integer &x, const Integer &e1, const Integer &y, const Integer &e2) const
void SimultaneousExponentiate (Element *results, const Element &base, const Integer *exponents, unsigned int exponentsCount) const
unsigned int MaxElementBitLength () const
unsigned int MaxElementByteLength () const
Element RandomElement (RandomNumberGenerator &rng, const RandomizationParameter &ignore_for_now=0) const
bool operator== (const ModularArithmetic &rhs) const
virtual Element Exponentiate (const Element &a, const Integer &e) const
virtual const AbstractGroup
< Integer > & 
MultiplicativeGroup () const
virtual bool InversionIsFast () const
virtual Element ScalarMultiply (const Element &a, const Integer &e) const
virtual Element CascadeScalarMultiply (const Element &x, const Integer &e1, const Element &y, const Integer &e2) const
virtual void SimultaneousMultiply (Element *results, const Element &base, const Integer *exponents, unsigned int exponentsCount) const

Static Public Attributes

static const RandomizationParameter DefaultRandomizationParameter

Protected Attributes

Integer m_modulus
Integer m_result
Integer m_result1

Detailed Description

ring of congruence classes modulo n

Note:
this implementation represents each congruence class as the smallest non-negative integer in that class

Definition at line 19 of file modarith.h.


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