RInteger Class Reference

#include <bigint.h>

class RInteger : public TInteger

Inherits from

Public Member Functions
RInteger(void)
RInteger(const RInteger &)
IMPORT_C voidCallClose(TAny *)
IMPORT_C voidClose(void)
IMPORT_C RIntegerNewEmptyL(TUint)
IMPORT_C RIntegerNewL(void)
IMPORT_C RIntegerNewL(const TDesC8 &)
IMPORT_C RIntegerNewL(const TInteger &)
IMPORT_C RIntegerNewL(TInt)
IMPORT_C RIntegerNewL(TUint)
IMPORT_C RIntegerNewPrimeL(TUint, TRandomAttribute)
IMPORT_C RIntegerNewRandomL(TUint, TRandomAttribute)
IMPORT_C RIntegerNewRandomL(const TInteger &, const TInteger &)
IMPORT_Coperator TCleanupItem()
IMPORT_C RInteger &operator=(const RInteger &)
Inherited Attributes
TInteger::iPtr
TInteger::iSize
Inherited Enumerations
TInteger:TRandomAttribute
TInteger:TSign
Inherited Functions
TInteger::Bit(TUint)const
TInteger::BitCount(void)const
TInteger::BufferLC()const
TInteger::BufferWithNoTruncationLC()const
TInteger::ByteCount(void)const
TInteger::CleanGrowL(TUint)
TInteger::CleanNewL(TUint)
TInteger::CleanResizeL(TUint)
TInteger::Construct(TInt)
TInteger::Construct(TUint)
TInteger::Construct(const TDesC8 &)
TInteger::Construct(const TInteger &)
TInteger::ConstructStack(TUint,TUint)
TInteger::ConstructStack(TUint,const TInteger &)
TInteger::ConvertToLong(void)const
TInteger::ConvertToLongL(void)const
TInteger::ConvertToUnsignedLong(void)const
TInteger::CopyL(const TInt,TBool)
TInteger::CopyL(const TInteger &,TBool)
TInteger::CreateNewL(TUint)
TInteger::DivideL(RInteger &,RInteger &,const TInteger &,const TInteger &)const
TInteger::DivideL(TUint &,RInteger &,const TInteger &,TUint)const
TInteger::DividedByL(TUint)const
TInteger::DividedByL(const TInteger &)const
TInteger::ExponentiateL(const TInteger &)const
TInteger::GCDL(const TInteger &)const
TInteger::InverseModL(const TInteger &)const
TInteger::IsConvertableToLong(void)const
TInteger::IsEven()const
TInteger::IsHeapBased(void)const
TInteger::IsNegative()const
TInteger::IsOdd()const
TInteger::IsPositive()const
TInteger::IsPrimeL(void)const
TInteger::IsStackBased(void)const
TInteger::IsZero()const
TInteger::MinusL(const TInteger &)const
TInteger::ModularExponentiateL(const TInteger &,const TInteger &,const TInteger &)
TInteger::ModularMultiplyL(const TInteger &,const TInteger &,const TInteger &)
TInteger::Modulo(const TInteger &,TUint)const
TInteger::ModuloL(TUint)const
TInteger::ModuloL(const TInteger &)const
TInteger::Negate(void)
TInteger::NotNegative()const
TInteger::NotPositive()const
TInteger::NotZero()const
TInteger::One(void)
TInteger::PlusL(const TInteger &)const
TInteger::PositiveAddL(const TInteger &,const TInteger &)const
TInteger::PositiveDivide(TUint &,TInteger &,const TInteger &,TUint)const
TInteger::PositiveDivideL(RInteger &,RInteger &,const TInteger &,const TInteger &)const
TInteger::PositiveMultiplyL(const TInteger &,const TInteger &)const
TInteger::PositiveSubtractL(const TInteger &,const TInteger &)const
TInteger::PrimeRandomizeL(TUint,TRandomAttribute)
TInteger::Ptr(void)const
TInteger::RandomizeL(TUint,TRandomAttribute)
TInteger::RandomizeL(const TInteger &,const TInteger &)
TInteger::Set(const RInteger &)
TInteger::SetBit(TUint)
TInteger::SetHeapBased(void)
TInteger::SetPtr(TUint *)
TInteger::SetSign(TSign)
TInteger::SetSize(TUint)
TInteger::SetStackBased(void)
TInteger::Sign(void)const
TInteger::SignedCompare(TInt)const
TInteger::SignedCompare(const TInteger &)const
TInteger::Size(void)const
TInteger::SmallPrimeRandomizeL(void)
TInteger::SquaredL(void)const
TInteger::TInteger(void)
TInteger::TimesL(const TInteger &)const
TInteger::Two(void)
TInteger::UnsignedCompare(const TInteger &)const
TInteger::WordCount(void)const
TInteger::Zero(void)
TInteger::operator!()const
TInteger::operator!=(TInt)const
TInteger::operator!=(const TInteger &)const
TInteger::operator%=(TInt)
TInteger::operator%=(const TInteger &)
TInteger::operator*=(TInt)
TInteger::operator*=(const TInteger &)
TInteger::operator++()
TInteger::operator+=(TInt)
TInteger::operator+=(const TInteger &)
TInteger::operator--()
TInteger::operator-=(TInt)
TInteger::operator-=(const TInteger &)
TInteger::operator/=(TInt)
TInteger::operator/=(const TInteger &)
TInteger::operator<(TInt)const
TInteger::operator<(const TInteger &)const
TInteger::operator<<=(TUint)
TInteger::operator<=(TInt)const
TInteger::operator<=(const TInteger &)const
TInteger::operator==(TInt)const
TInteger::operator==(const TInteger &)const
TInteger::operator>(TInt)const
TInteger::operator>(const TInteger &)const
TInteger::operator>=(TInt)const
TInteger::operator>=(const TInteger &)const
TInteger::operator>>=(TUint)

Detailed Description

A TInteger derived class allowing the construction of variable length big integers. See the Cryptography API guide for further information.

See also: TInteger

Constructor & Destructor Documentation

RInteger ( void )

IMPORT_CRInteger(void)

Creates an RInteger object with no associated internal (heap) storage.

All data members are initialised to zero. It is safe (although not strictly necessary) to push such an RInteger object onto the CleanupStack. This is useful, for example, if you want to pass an RInteger object by reference into a function and have it create the representation of the actual integer for you.

Note that performing any operation on such an RInteger object other than the default assignment operator or copy constructor will panic your code.

Return Value
A stack based class that has no associated internal storage and thus does not represent any number.

RInteger ( const RInteger & )

IMPORT_CRInteger(const RInteger &aInteger)

Copy constructor

This function performs a shallow copy, i.e. the memory holding the integer is not copied.

Member Function Documentation

CallClose ( TAny * )

IMPORT_C voidCallClose(TAny *aPtr)[static]

Helper function registered with the cleanup stack that just calls Close() for this RInteger object.

Parameters
aPtrA pointer to the object for which clean-up is to be performed.

Close ( void )

IMPORT_C voidClose(void)

Zeros and then frees any memory owned by this RInteger object.

An RInteger object that has been closed can safely fall off the stack.

NewEmptyL ( TUint )

IMPORT_C RIntegerNewEmptyL(TUintaNumWords)[static]

Creates a new integer with a preallocated internal storage of aNumWords all initialised to zero.

The resulting RInteger object is logically equivalent to RInteger::NewL(0). The only difference is that the internal storage requirements have been specified to be larger than the default. This is useful if you are about to perform an operation on this integer, that you know the resulting size requirements of, and wish to avoid a heap resize.

Parameters
aNumWordsThe number of words for to preallocated and zero fill.
Return Value
An RInteger object representing 0 with a preallocated zero-filled internal storage of aNumWords.

NewL ( void )

IMPORT_C RIntegerNewL(void)[static]

Creates a new integer representing 0.

Return Value
An RInteger by value.

NewL ( const TDesC8 & )

IMPORT_C RIntegerNewL(const TDesC8 &aValue)[static]

Creates a new integer object representing a specified value.

Parameters
aValueA descriptor containing the big-endian binary representation of the value.
Return Value
An RInteger object representing the value.

NewL ( const TInteger & )

IMPORT_C RIntegerNewL(const TInteger &aInteger)[static]

Creates an exact copy of an aInteger object.

Parameters
aIntegerThe integer you wish to copy
Return Value
An RInteger object representing an exact copy of aInteger by value.

NewL ( TInt )

IMPORT_C RIntegerNewL(TIntaInteger)[static]

Creates a new integer from the value represented by aInteger.

Parameters
aIntegerA signed word sized integer.
Return Value
An RInteger representation of aInteger by value.

NewL ( TUint )

IMPORT_C RIntegerNewL(TUintaInteger)[static]

Creates a new integer from the value represented by aInteger.

Parameters
aIntegerAn unsigned word sized integer.
Return Value
An RInteger representation of aInteger by value.

NewPrimeL ( TUint, TRandomAttribute )

IMPORT_C RIntegerNewPrimeL(TUintaBits,
TRandomAttributeaAttr = EAllBitsRandom
)[static]

Finds a random prime integer in the range of [2, 2^aBits].

This is done by picking a random integer and using that as a starting point for a sequential search for a prime. To verify the primality of number, this algorithm uses a probablistic primality test. This means that it is possible, although extremely improbable, that the number returned is a pseudoprime.

Parameters
aBitsThe number of bits you wish to randomly select your prime from.
aAttrEnum specifying whether specific bits in the random number should be set. See TRandomAttribute for more information.
Return Value
A random RInteger representing a probable prime (with very high probablity) in the range specified.

NewRandomL ( TUint, TRandomAttribute )

IMPORT_C RIntegerNewRandomL(TUintaBits,
TRandomAttributeaAttr = EAllBitsRandom
)[static]

Creates a random integer uniformly distributed over [0, 2^aBits].

Parameters
aBitsThe number of bits you wish to randomly select.
aAttrEnum specifying whether specific bits in the random number should be set. See TRandomAttribute for more information.
Return Value
A random RInteger object in the range specified.

NewRandomL ( const TInteger &, const TInteger & )

IMPORT_C RIntegerNewRandomL(const TInteger &aMin,
const TInteger &aMax
)[static]

Creates a random integer uniformly distributed over [x | min <= x <= max].

Parameters
aMinThe smallest possible value for the random integer (inclusive).
aMaxThe largest possible value for the random integer (inclusive).
Return Value
A random RInteger object in the range specified.

operator TCleanupItem ( )

IMPORT_Coperator TCleanupItem()

An overloaded TCleanupItem() allowing the RIntegers to be pushed, popped, and destroyed via the CleanupStack like any other CBase derived object.

operator= ( const RInteger & )

IMPORT_C RInteger &operator=(const RInteger &aInteger)

Assignment operator

This function performs a shallow copy, i.e. the memory holding the integer is not copied.