Einzelnen Beitrag anzeigen

shmia

Registriert seit: 2. Mär 2004
5.508 Beiträge
 
Delphi 5 Professional
 
#3

Re: Eine BigInt Klasse + RSA-Beispiel

  Alt 26. Jul 2006, 17:12
Falsch!!!
Delphi-Quellcode:
procedure TBigInt.Free;
begin
  if (Assigned(Self)) then
  begin
    ZeroMemory(@FDigits[0], DigitCount*4); // object might handle prime factors for
    SetLength(FDigits, 0); // crypto keys - overwrite memory with zeros
    FNegative := False;
    Inherited Free;
  end;
end;
Richtig:
Delphi-Quellcode:
destructor TBigInt.Destroy;
begin
   ZeroMemory(@FDigits[0], DigitCount*4); // object might handle prime factors for
                                      // crypto keys - overwrite memory with zeros
// SetLength(FDigits, 0); // Delphi destroys dyn. arrays
   inherited;
end;
Andreas
  Mit Zitat antworten Zitat