inherits from Exception
Root of the legacy multi-precision exception hierarchy. Every unit in the stMP* layer raises a descendant of this class, so an application can catch the whole layer with a single handler. It mirrors eDSIError (StreamSec.DSI.ArithTypes), which does the same job for the DSI layer that superseded this one, and is declared here for the same reason: this is the deepest unit of the layer, so every other stMP* unit already reaches it.
(no public members)
(no public members)
(no public members)
(no public members)
(no public members)
(no public members)
(no public members)
(no public members)
function GetInstance: TObject;
function Compare(aElement: iFieldElement): Boolean;
inherits from iFieldElement
function AsFiniteFieldElement: iMPFiniteFieldElement;
function AsIntegerConv: iMPIntegerConv;
function AsIntegerEx: iMPIntegerEx;
function AsFiniteFieldElement2: iMPFiniteFieldElement2;
function AsIntegerConv2: iMPIntegerConv2;
function AsIntegerEx2: iMPIntegerEx2;
procedure Assign(Source: iMPInteger);
procedure AssignTo(var Dest: iMPInteger);
function Clone: iMPInteger;
procedure Realloc(NewSize: Cardinal);
procedure Clear;
function MSB: Integer;
function MSBIsEqualTo(aValue: Integer): Boolean;
function CmpOffset(B: iMPInteger; Offset: Cardinal = 0): Integer;
function GetSize: Cardinal;
function GetSign: Integer;
function GetData(index: Cardinal): UInt32;
function GetDataPtr: pMPIntData;
function GetOwnerData: Boolean;
function GetInstance: TObject;
function GetPool: tSsAbstractMPArith;
procedure SetData(index: Cardinal; Value: UInt32);
procedure SetDataPtr(aData : pMPIntData; aSize : Cardinal; aOwnerData: Boolean = False);
procedure SetSign(Value: Integer);
property Data[index: Cardinal]: UInt32 read GetData write SetData;
property Pool: tSsAbstractMPArith read GetPool;
property Sign: Integer read GetSign write SetSign;
property Size: Cardinal read GetSize;
inherits from iRawRandom
function GetPool: tSsAbstractMPArith;
procedure MPRawRandom(var X: iMPInteger; MaxBitSize: Cardinal);
procedure SetPool(APool: tSsAbstractMPArith);
property Pool: tSsAbstractMPArith read GetPool;
(no public members)
(no public members)
(no public members)
(no public members)
(no public members)
function AsStandardPrimeParams: iStandardPrimeParams;
function AsStrongPrimeParams: iStrongPrimeParams;
function AsSubGroupParams: iSubGroupParams;
function AsDSAParams: IDSAParams;
function AsMaurerParams: iMaurerParams;
inherits from iPrimeGenParams
function GetF: iMPInteger;
function GetMod8: Byte;
function GetPMin: iMPInteger;
function GetPUBound: iMPInteger;
procedure SetF(const Value: iMPInteger);
procedure SetMod8(const Value: Byte);
procedure SetPMin(const Value: iMPInteger);
procedure SetPUBound(const Value: iMPInteger);
property PMin: iMPInteger read GetPMin write SetPMin;
property PUBound: iMPInteger read GetPUBound write SetPUBound;
property F: iMPInteger read GetF write SetF;
property Mod8: Byte read GetMod8 write SetMod8;
inherits from iStandardPrimeParams
function GetLR: Cardinal;
function GetLS: Cardinal;
function GetLT: Cardinal;
procedure SetLR(const Value: Cardinal);
procedure SetLS(const Value: Cardinal);
procedure SetLT(const Value: Cardinal);
property LS: Cardinal read GetLS write SetLS;
property LT: Cardinal read GetLT write SetLT;
property LR: Cardinal read GetLS write SetLR;
inherits from iPrimeGenParams
function Getc: iMPInteger;
function Getq: iMPInteger;
function Getl: Cardinal;
function GetPMin: iMPInteger;
function GetPUBound: iMPInteger;
procedure Setc(const Value: iMPInteger);
procedure Setq(const Value: iMPInteger);
procedure Setl(const Value: Cardinal);
procedure SetPMin(const Value: iMPInteger);
procedure SetPUBound(const Value: iMPInteger);
property PMin: iMPInteger read GetPMin write SetPMin;
property PUBound: iMPInteger read GetPUBound write SetPUBound;
property c: iMPInteger read Getc write Setc;
property q: iMPInteger read Getq write Setq;
property l: Cardinal read Getl write Setl;
inherits from iPrimeGenParams
function Getl: Cardinal;
function Getq: iMPInteger;
function GetSeed: tBytes;
procedure Setl(const Value: Cardinal);
procedure Setq(Value: iMPInteger);
procedure SetSeed(const Value: tBytes);
property Seed: tBytes read GetSeed write SetSeed;
property q: iMPInteger read Getq write Setq;
property l: Cardinal read Getl write Setl;
inherits from iPrimeGenParams
function Getq: iMPInteger;
procedure Setq(const Value: iMPInteger);
property q: iMPInteger read Getq write Setq;
function GetInstance: tSsAbstractMPArith;
function IsUsed: Boolean;
function MPCopy(const aSource: iMPInteger): iMPInteger;
procedure MPRealloc(var aA : iMPInteger; aNewSize: Cardinal; aProtect: Boolean = True);
procedure MPDealloc(const aA: iMPInteger);
inherits from tObject
implements iUnknown, iBasicMPArith
constructor CreateDefault; virtual;
function IsUsed: Boolean; virtual; abstract;
property PRNG: iMPRawRandom read fPRNG write SetPRNG;
property IntegerCount: Integer read fIntegerCount;
inherits from iMPInteger
function ToBase16: AnsiString;
function ToBase256: tBytes; overload;
function ToBase256(FixedOutputLen: Cardinal): tBytes; overload;
procedure ToBase256(var Buf; Count: Cardinal); overload;
procedure UToBase256(var Buf; Count: Cardinal);
function ToBaseB(B: Cardinal; const Digits: OctetString): OctetString;
function ToBase10: AnsiString;
inherits from iMPInteger
function FromBase16(const HexStr: AnsiString): Boolean;
function ToBase16: AnsiString;
procedure FromBase256(const Str: tBytes); overload;
procedure FromBase256(const Str: tBytes; MaxBitSize: Cardinal); overload;
procedure FromBase256(const Str: tBytes; Offset, Count, MaxBitSize: Cardinal); overload;
procedure FromBase256(const Buf; Count: Cardinal; MaxBitSize: Cardinal); overload;
function ToBase256: tBytes; overload;
function ToBase256(FixedOutputLen: Cardinal): tBytes; overload;
procedure ToBase256(var Buf; Count: Cardinal); overload;
procedure UFromBase256(const Buf; Count: Cardinal; MaxBitSize: Cardinal); overload;
procedure UFromBase256(const Str: tBytes; Offset, Count, MaxBitSize: Cardinal); overload;
procedure UToBase256(var Buf; Count: Cardinal); overload;
procedure UToBase256(const Str: tBytes; Offset, Count: Cardinal); overload;
function FromBaseB(B: Cardinal; const Digits, Str: OctetString): Boolean;
function ToBaseB(B: Cardinal; const Digits: OctetString): OctetString;
function FromBase10(const Str: AnsiString): Boolean;
function ToBase10: AnsiString;
inherits from iMPIntegerConv2
function Add2(B: iMPInteger; Res: iMPInteger = nil): iMPInteger;
function Inc2( B: iMPInteger = nil): iMPInteger;
function Sub2(B: iMPInteger; Res: iMPInteger = nil): iMPInteger;
function Dec2( B: iMPInteger = nil): iMPInteger;
function Mul2(B: iMPInteger; R: iMPInteger = nil): iMPInteger;
function DivByInt2(M: UInt32; var R: UInt32; Q: iMPInteger = nil): iMPInteger;
function Mod2(M: iMPInteger; R: iMPInteger = nil): iMPInteger;
function ModByInt(P: UInt32): UInt32;
function MulMod2(B, M: iMPInteger; R: iMPInteger = nil): iMPInteger;
function MulByInt2(Y: LongInt; R: iMPInteger = nil): iMPInteger;
function ExpMod(E, M: iMPInteger; R: iMPInteger = nil): iMPInteger;
function Pow2Mod(E, M: iMPInteger; R: iMPInteger = nil): iMPInteger;
function Pow4Mod(E, M: iMPInteger; R: iMPInteger = nil): iMPInteger;
function PowBMod(Base: UInt32; E, M: iMPInteger; R: iMPInteger = nil): iMPInteger;
procedure MontgomeryParams(M: iMPInteger; var R, RQuad: iMPInteger; var MPrime: UInt32);
function KaratsubaMul2(B: iMPInteger; C: iMPInteger = nil): iMPInteger;
function KaratsubaSqr2(R: iMPInteger = nil): iMPInteger;
function KaratsubaExpMod(E, M: iMPInteger; R: iMPInteger = nil): iMPInteger;
function KaratsubaPow2Mod(E, M: iMPInteger; R: iMPInteger = nil): iMPInteger;
function KaratsubaPowBMod(Base: Cardinal; E, M: iMPInteger; R: iMPInteger = nil): iMPInteger;
function MPShl2(boffs: Integer; R: iMPInteger = nil): iMPInteger;
function BinaryGCD(Y: iMPInteger; AGCD: iMPInteger = nil): iMPInteger;
function BinaryInvMod(M: iMPInteger; AInv: iMPInteger = nil): iMPInteger;
function InvMod(M: iMPInteger; AInv: iMPInteger = nil): iMPInteger;
function DivMod2(B, M: iMPInteger; Q: iMPInteger = nil): iMPInteger;
function LegendreSymbol(P: iMPInteger): Integer;
function JacobiSymbol(N: iMPInteger): Integer;
procedure LucasSequence(P, Q, K: iMPInteger; var V, QR: iMPInteger);
function SqrtModPrime2(P: iMPInteger; Z: iMPInteger = nil): iMPInteger;
function MillerRabin(T: Integer): Boolean;
function FastMillerRabin(T: Integer): Boolean;
function TrialDiv(T: Integer): Boolean;
inherits from iMPIntegerConv
procedure Add(B: iMPInteger);
function Add2(B: iMPInteger; Res: iMPInteger = nil): iMPInteger;
procedure Inc;
function Inc2( B: iMPInteger = nil): iMPInteger;
procedure Sub(B: iMPInteger);
function Sub2(B: iMPInteger; Res: iMPInteger = nil): iMPInteger;
procedure Dec;
function Dec2( B: iMPInteger = nil): iMPInteger;
procedure Mul(B: iMPInteger);
function Mul2(B: iMPInteger; R: iMPInteger = nil): iMPInteger;
function ModDiv(M: iMPInteger; Q: iMPInteger = nil; AdjustSize: Boolean = True): iMPInteger;
function DivByInt2(M: UInt32; var R: UInt32; Q: iMPInteger = nil): iMPInteger;
procedure ModRed(M: iMPInteger);
function Mod2(M: iMPInteger; R: iMPInteger = nil): iMPInteger;
function ModByInt(P: UInt32): UInt32;
procedure MulMod(B, M: iMPInteger);
function MulMod2(B, M: iMPInteger; R: iMPInteger = nil): iMPInteger;
procedure MulByInt(Y: LongInt);
function MulByInt2(Y: LongInt; R: iMPInteger = nil): iMPInteger;
function ExpMod(E, M: iMPInteger; R: iMPInteger = nil): iMPInteger;
function Pow2Mod(E, M: iMPInteger; R: iMPInteger = nil): iMPInteger;
function Pow4Mod(E, M: iMPInteger; R: iMPInteger = nil): iMPInteger;
function PowBMod(Base: UInt32; E, M: iMPInteger; R: iMPInteger = nil): iMPInteger;
procedure MontgomeryParams(M: iMPInteger; var R, RQuad: iMPInteger; var MPrime: UInt32);
function KaratsubaMul2(B: iMPInteger; C: iMPInteger = nil): iMPInteger;
function KaratsubaSqr2(R: iMPInteger = nil): iMPInteger;
function KaratsubaExpMod(E, M: iMPInteger; R: iMPInteger = nil): iMPInteger;
function KaratsubaPow2Mod(E, M: iMPInteger; R: iMPInteger = nil): iMPInteger;
function KaratsubaPowBMod(Base: Cardinal; E, M: iMPInteger; R: iMPInteger = nil): iMPInteger;
procedure GarnerCRT(const M, V: array of iMPInteger);
procedure MPShl(boffs: Integer);
procedure MPShr(boffs: Integer);
function MPShl2(boffs: Integer; R: iMPInteger = nil): iMPInteger;
procedure MPMask(MaskBits: Integer);
function BinaryGCD(Y: iMPInteger; AGCD: iMPInteger = nil): iMPInteger;
function BinaryInvMod(M: iMPInteger; AInv: iMPInteger = nil): iMPInteger;
function InvMod(M: iMPInteger; AInv: iMPInteger = nil): iMPInteger;
procedure DivMod(B, M: iMPInteger);
function DivMod2(B, M: iMPInteger; Q: iMPInteger = nil): iMPInteger;
function LegendreSymbol(P: iMPInteger): Integer;
function JacobiSymbol(N: iMPInteger): Integer;
procedure LucasSequence(P, Q, K: iMPInteger; var V, QR: iMPInteger);
function SqrtModPrime2(P: iMPInteger; Z: iMPInteger = nil): iMPInteger;
function MillerRabin(T: Integer): Boolean;
function FastMillerRabin(T: Integer): Boolean;
procedure Random(HighBit: Cardinal);
procedure RandomBound(XMin, XUBound: iMPInteger);
procedure DSARandom(Seed: iMPInteger; var j: Cardinal; l: Integer);
function TrialDiv(T: Integer): Boolean;
function MillerRabinTest(var Y, NMin1: iMPInteger; S: Integer): Boolean;
procedure Prime(BitSize: Cardinal; Algo: tPrimeAlgo; Params: iPrimeGenParams = nil; aTerminate: tGetTerminate = nil);
inherits from iMPIntegerConv2
function GetFieldModulus: iMPIntegerEx2;
function FFAdd2(B: iMPInteger; C: iMPInteger = nil): iMPInteger;
function FFInc2(B: iMPInteger = nil): iMPInteger;
function FFSub2(B: iMPInteger; C: iMPInteger = nil): iMPInteger;
function FFDec2(B: iMPInteger = nil): iMPInteger;
function FFMul2(B: iMPInteger; R: iMPInteger = nil): iMPInteger;
function FFMulByInt2(Y: LongInt; R: iMPInteger = nil): iMPInteger;
function FFExpMod(E: iMPInteger; R: iMPInteger = nil): iMPInteger;
function FFPow2Mod(E: iMPInteger; R: iMPInteger = nil): iMPInteger;
function FFPow4Mod(E: iMPInteger; R: iMPInteger = nil): iMPInteger;
function FFPowBMod(Base: UInt32; E: iMPInteger; R: iMPInteger = nil): iMPInteger;
function FFKaratsubaMul2(B: iMPInteger; C: iMPInteger = nil): iMPInteger;
function FFKaratsubaSqr2(R: iMPInteger = nil): iMPInteger;
function FFKaratsubaExpMod(E: iMPInteger; R: iMPInteger = nil): iMPInteger;
function FFKaratsubaPow2Mod(E: iMPInteger; R: iMPInteger = nil): iMPInteger;
function FFKaratsubaPowBMod(Base: Cardinal; E: iMPInteger; R: iMPInteger = nil): iMPInteger;
function FFShl2(boffs: Integer; R: iMPInteger = nil): iMPInteger;
function FFBinaryInv(AInv: iMPInteger = nil): iMPInteger;
function FFInv(AInv: iMPInteger = nil): iMPInteger;
function FFDiv2(B: iMPInteger; Q: iMPInteger = nil): iMPInteger;
function FFSqrt2(Z: iMPInteger = nil): iMPInteger;
property FieldModulus: iMPIntegerEx2 read GetFieldModulus;
inherits from iMPIntegerConv
function GetFieldModulus: iMPIntegerEx2;
procedure SetFieldModulus(Value: iMPIntegerEx2);
procedure FFAdd(B: iMPInteger);
function FFAdd2(B: iMPInteger; C: iMPInteger = nil): iMPInteger;
procedure FFInc;
function FFInc2(B: iMPInteger = nil): iMPInteger;
procedure FFSub(B: iMPInteger);
function FFSub2(B: iMPInteger; C: iMPInteger = nil): iMPInteger;
procedure FFDec;
function FFDec2(B: iMPInteger = nil): iMPInteger;
procedure FFMul(B: iMPInteger);
function FFMul2(B: iMPInteger; R: iMPInteger = nil): iMPInteger;
procedure FFMulByInt(Y: LongInt);
function FFMulByInt2(Y: LongInt; R: iMPInteger = nil): iMPInteger;
function FFExpMod(E: iMPInteger; R: iMPInteger = nil): iMPInteger;
function FFPow2Mod(E: iMPInteger; R: iMPInteger = nil): iMPInteger;
function FFPow4Mod(E: iMPInteger; R: iMPInteger = nil): iMPInteger;
function FFPowBMod(Base: UInt32; E: iMPInteger; R: iMPInteger = nil): iMPInteger;
function FFKaratsubaMul2(B: iMPInteger; C: iMPInteger = nil): iMPInteger;
function FFKaratsubaSqr2(R: iMPInteger = nil): iMPInteger;
function FFKaratsubaExpMod(E: iMPInteger; R: iMPInteger = nil): iMPInteger;
function FFKaratsubaPow2Mod(E: iMPInteger; R: iMPInteger = nil): iMPInteger;
function FFKaratsubaPowBMod(Base: Cardinal; E: iMPInteger; R: iMPInteger = nil): iMPInteger;
procedure FFShl(boffs: Integer);
procedure FFShr(boffs: Integer);
function FFShl2(boffs: Integer; R: iMPInteger = nil): iMPInteger;
function FFBinaryInv(AInv: iMPInteger = nil): iMPInteger;
function FFInv(AInv: iMPInteger = nil): iMPInteger;
procedure FFDiv(B: iMPInteger);
function FFDiv2(B: iMPInteger; Q: iMPInteger = nil): iMPInteger;
function FFSqrt2(Z: iMPInteger = nil): iMPInteger;
property FieldModulus: iMPIntegerEx2 read GetFieldModulus write SetFieldModulus;
inherits from tInterfacedObject
implements iMPInteger, iFieldElement
constructor Create(aPool: tSsAbstractMPArith);
destructor Destroy; override;
function AsFiniteFieldElement: iMPFiniteFieldElement;
function AsIntegerConv: iMPIntegerConv;
function AsIntegerEx: iMPIntegerEx;
function AsFiniteFieldElement2: iMPFiniteFieldElement2;
function AsIntegerConv2: iMPIntegerConv2;
function AsIntegerEx2: iMPIntegerEx2;
procedure Assign(Source: iMPInteger); virtual; abstract;
procedure AssignTo(var Dest: iMPInteger); virtual; abstract;
function Compare(aElement: iFieldElement): Boolean;
function Clone: iMPInteger; virtual; abstract;
procedure Realloc(NewSize: Cardinal); virtual; abstract;
procedure Clear; virtual; abstract;
function MSB: Integer; virtual; abstract;
function MSBIsEqualTo(aValue: Integer): Boolean;
function CmpOffset(B: iMPInteger; Offset: Cardinal = 0): Integer; virtual; abstract;
function GetData(index: Cardinal): UInt32;
procedure SetData(index: Cardinal; Value: UInt32);
procedure SetSign(Value: Integer);
property Data[index: Cardinal]: UInt32 read GetData write SetData;
property Pool: tSsAbstractMPArith read GetPool;
property Size: Cardinal read GetSize;
property Sign: Integer read GetSign write SetSign;
function GetPrimeModulus: iMPInteger;
function GetGroupOrder: iMPInteger;
function GetCoFactor: iMPInteger;
function GetGenerator: iFieldElement;
procedure SetPrimeModulus(Value: iMPInteger);
procedure SetGroupOrder(Value: iMPInteger);
procedure SetCoFactor(Value: iMPInteger);
procedure SetGenerator(Value: iFieldElement);
procedure Assign(aSrc: iDiscreteLogField);
function Compare(aParams: iDiscreteLogField): Boolean;
function Validate: Boolean;
property PrimeModulus: iMPInteger read GetPrimeModulus write SetPrimeModulus;
property GroupOrder: iMPInteger read GetGroupOrder write SetGroupOrder;
property CoFactor: iMPInteger read GetCoFactor write SetCoFactor;
property Generator: iFieldElement read GetGenerator write SetGenerator;
(no public members)
procedure Assign(ASource: iDiscreteLogField);
function GetInstance: tObject;
function GetPool: tSsAbstractMPArith;
function GetA: iMPInteger;
function GetB: iMPInteger;
function GetQ: iMPInteger;
function GetR: iMPInteger;
function GetK: iMPInteger;
function GetG: IECPoint;
function GetCurveOID: ObjectIdentifier;
procedure ModProc( A: iMPInteger; M: iMPInteger);
function MulModProc(X, Y, M: iMPInteger; R: iMPInteger = nil): iMPInteger;
procedure SetA(Value: iMPInteger);
procedure SetB(Value: iMPInteger);
procedure SetQ(Value: iMPInteger);
procedure SetR(Value: iMPInteger);
procedure SetK(Value: iMPInteger);
property Pool: tSsAbstractMPArith read GetPool;
property A: iMPInteger read GetA write SetA;
property B: iMPInteger read GetB write SetB;
property Q: iMPInteger read GetQ write SetQ;
property R: iMPInteger read GetR write SetR;
property K: iMPInteger read GetK write SetK;
property G: IECPoint read GetG;
property CurveOID: ObjectIdentifier read GetCurveOID;
inherits from iFieldElement
function GetCurve: iECurve;
function GetFE2OSFormat: tECP2OSFormat;
function GetPool: tSsAbstractMPArith;
function GetX: iMPInteger;
function GetY: iMPInteger;
function GetZ: iMPInteger;
procedure SetCurve(ACurve: iECurve);
procedure SetFE2OSFormat(const Value: tECP2OSFormat);
procedure SetX(Value: iMPInteger);
procedure SetY(Value: iMPInteger);
procedure SetZ(Value: iMPInteger);
procedure Assign(ASource: IECPoint);
property Curve: iECurve read GetCurve;
property Pool: tSsAbstractMPArith read GetPool;
property X: iMPInteger read GetX write SetX;
property Y: iMPInteger read GetY write SetY;
property Z: iMPInteger read GetZ write SetZ;
property FE2OSFormat: tECP2OSFormat read GetFE2OSFormat write SetFE2OSFormat;
inherits from tInterfacedObject
implements iDiscreteLogField
constructor Create(aPool: tSsAbstractMPArith);
destructor Destroy; override;
procedure Assign(aSource: IDiscreteLogField);
function Compare(aParams: IDiscreteLogField): Boolean; virtual;
function Validate: Boolean; virtual;
class function IsCurve(ACurve: iECurve): Boolean; virtual;
property Pool: tSsAbstractMPArith read GetPool;
property A: iMPInteger read GetA write SetA;
property B: iMPInteger read GetB write SetB;
property Q: iMPInteger read GetQ write SetQ;
property R: iMPInteger read GetR write SetR;
property K: iMPInteger read GetK write SetK;
property G: IECPoint read GetG;
inherits from tInterfacedObject
implements IECPoint
constructor Create(APool: tSsAbstractMPArith; aCurve: iECurve);
procedure Assign(aSource: IECPoint);
function Compare(aElement: iFieldElement): Boolean;
procedure SetCurve(aCurve: iECurve);
property Curve: iECurve read GetCurve;
property Pool: tSsAbstractMPArith read GetPool;
property X: iMPInteger read GetX write SetX;
property Y: iMPInteger read GetY write SetY;
property Z: iMPInteger read GetZ write SetZ;
property FE2OSFormat: tECP2OSFormat read GetFE2OSFormat write SetFE2OSFormat;