[fpc-pascal] I need some help with using Rijndael encryption algorithm

Frank Church vfclists at gmail.com
Sun Dec 26 17:43:47 CET 2010


I am using the Rijndael algorithm to encrypt some application settings, but
it does not generate the type of variation in the encrypted output I expect.
I am not quite sure if that is a flaw, just normal behaviour, or I am
failing to set some additional parameters properly.

Here is my current implementation. I expect a whole lot more variation in
the output when I add more characters, but the previous parts don't change
much.


unit testform;
>
> {$mode objfpc}{$H+}
>
> interface
>
> uses
>   Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics,
> Dialogs,
>   StdCtrls, DCPrijndael, DCPsha1;
>
> type
>
>   { TForm1 }
>
>   TForm1 = class(TForm)
>     edtKeyString: TEdit;
>     edtInputText: TEdit;
>     edtEncryptedText: TEdit;
>     Label1: TLabel;
>     Label2: TLabel;
>     Label3: TLabel;
>     procedure edtInputTextChange(Sender: TObject);
>   private
>     { private declarations }
>   public
>     { public declarations }
>   end;
>
> var
>   Form1: TForm1;
>
> implementation
>
> { TForm1 }
>
> procedure TForm1.edtInputTextChange(Sender: TObject);
> var
>   Cipher: TDCP_rijndael;
> begin
>   Cipher:= TDCP_rijndael.Create(Self);
>   Cipher.InitStr(edtKeyString.Text,TDCP_sha1);
>   edtEncryptedText.Text := Cipher.EncryptString(edtInputText.Text);
>   Cipher.Burn;
>   Cipher.Free;
> end;
>
> initialization
>   {$I testform.lrs}
>
> end.
>





-- 
Frank Church

=======================
http://devblog.brahmancreations.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20101226/6636f336/attachment.html>


More information about the fpc-pascal mailing list