Thema
:
"Verschlüsselte" Bilddateien "entschlüsseln"
Einzelnen Beitrag anzeigen
nicodex
Registriert seit: 2. Jan 2008
Ort: Darmstadt
286 Beiträge
Delphi 2007 Professional
#
11
Re: "Verschlüsselte" Bilddateien "entschlüsse
23. Okt 2008, 14:52
zusammenfalten
·
markieren
Delphi-Quellcode:
const
FileName = '
D:\Temp\karten.decoded.png
';
var
Source: TFileStream;
Header:
array
[0..3]
of
AnsiChar;
Stream: TMemoryStream;
Buffer: PByte;
Index
: Integer;
begin
Source := TFileStream.Create(FileName, fmOpenRead);
try
Stream := TMemoryStream.Create();
try
Header := '
CF10
';
Stream.WriteBuffer(Header, SizeOf(Header));
if
Source.Size > 0
then
begin
Source.Position := 0;
Stream.CopyFrom(Source, Source.Size);
Buffer := Stream.Memory;
Inc(Buffer, SizeOf(Header));
for
Index
:= 1
to
Stream.Size - SizeOf(Header)
do
begin
Buffer^ := Buffer^
xor
$8D;
Inc(Buffer);
end
;
end
;
Stream.SaveToFile(ExtractFilePath(FileName) + ChangeFileExt(
StringReplace(ExtractFileName(FileName), '
.decoded
', '
',
[rfReplaceAll, rfIgnoreCase]), '
.encoded
') + ExtractFileExt(FileName));
finally
Stream.Free();
end
;
finally
Source.Free();
end
;
end
;
Nico Bendlin
Ambermoon-Soundtrack-CD Preorder-Page
Generic Properties for Blender Library Data
Zitat
nicodex
Öffentliches Profil ansehen
Mehr Beiträge von nicodex finden