DES Cryptography Block Cipher from Delphi
The DES method is one of the best way to secure your file. It's workflow is quite simple. To encode, give a string as your digital sign key and embed it into the file. While to decode, give again the string to put back the original file. The initialization procedure to create the block cipher you can see as shown below:
procedure CreateBlockCipher;Next below will explain you how to encode and decode the file
const BlockCiphers: array
[0..1] of TBlockCipherClass = (TDESCipher, TBlowfishCipher);
var Key: Int64;
begin
with TDoubleDWORD(Key) do
begin
R := $01234567;
L :=
$89abcdef;
end;
FBlockCipher.Free;
FBlockCipher :=
BlockCiphers[0].Create(Key,SizeOf(Key));
end;
Input := TFileStream.Create(InputFileName, fmOpenRead);And this is the picture of my application:
Input.Seek(0, soFromBeginning);
InputSize := Input.Size;
CreateBlockCipher;
Output := TFileStream.Create(OutputFileName,
fmCreate);
Output.Seek(0, soFromBeginning);
ShowTransformingLabel(TransformingCaption);
if ((Sender = btnEnkripsi)
or (Sender = Enkripsi1)) then
FBlockCipher.EncryptStream(Input, Output)
else
FBlockCipher.DecryptStream(Input, Output);
Next picture describes you the difference between the sample PDF file and the result file:
PS: If you've benefit from this blog, you can support it by making a small contribution. |
Sunday, February 08, 2009 8:58:00 PM
bisa di ownload gx aplikasi n source DES Cryptography Block Cipher from Delphi" nya mas?
dari:
sir.ramonez@yahoo.co.id
Monday, February 09, 2009 11:30:00 AM
Kalau mau serius, bisa japri saya via email.
Wednesday, September 22, 2010 11:14:00 PM
Hi,
I just wanted to say that I really enjoyed your blog and this post. You make some very informative points. Keep up the great work!
-
Delphi development