Registriert seit: 29. Mai 2002
37.621 Beiträge
Delphi 2006 Professional
|
Re: Datei stückchenweise mit TFileStream einlesen
4. Okt 2003, 13:18
Entschlüsseln:
Delphi-Quellcode:
// ignore the file header
SrcStream.Seek(sizeof(TFileHeader), soFromBeginning);
// assign the Cipherclass
CipherClass := Cipher;
// prepare for decoding
with CipherClass.Create(PW, nil) do
begin
Mode := cmCFB;
InitKey(PW, nil);
// as long as we have not reached the end of the source stream
repeat
Len := SrcStream.Read(Buffer, SizeOf(Buffer));
EncodeBuffer(Buffer, Buffer, Len);
DestStream.WriteBuffer(Buffer, Len);
until Len = 0;
end;
Verschlüsseln:
Delphi-Quellcode:
// write the head into the stream
DestStream.Write(FileHeader, sizeof(TFileHeader));
// prpare vor encoding
with CipherClass.Create(PW, nil) do
begin
Mode := cmCFB;
InitKey(PW, nil);
// as long as Len has something to read
repeat
Len := SrcStream.Read(Buffer, SizeOf(Buffer));
EncodeBuffer(Buffer, Buffer, Len);
DestStream.WriteBuffer(Buffer, Len);
until Len = 0;
end;
Was habe ich übersehen?
Michael Ein Teil meines Codes würde euch verunsichern.
|
|
Zitat
|