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 earlier characters of the output 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.
regards
/vfclists