XTea encryption algorithm. Main features:

  • Fast uncomplicated encryption / decryption
  • Works with Delphi 2006, 2007, 2009, 2010 and Delphi for .NET
DirectoryWatch download: Version 1.0.1 (24.01.2010)

The demo bellow shows the basic usage of XTea. If you have trouble using the code or have any other questions, please contact me directly using the “Contact” page.

Sample usage:

procedure TForm1.btnEnryptClick(Sender: TObject);
var
  InStream: TMemoryStream;
begin
  InStream := TMemoryStream.Create;
  try
    FEncodedBytes.Clear;
    mmDecrypted.Lines.Clear;
    mmOriginal.Lines.SaveToStream(InStream);
    XTeaEncryptStream(InStream, FEncodedBytes, GetBytesFromAnsiString('1234567890'));
 
    mmEncrypted.Lines.Text := 'The memo content is now encoded!'
  finally
    InStream.Free;
  end;
end;
procedure TForm1.btnDecryptClick(Sender: TObject);
var
  OutStream: TMemoryStream;
begin
  OutStream := TMemoryStream.Create;
  try
    FEncodedBytes.Seek(0, soFromBeginning);
 
    XTeaDecryptStream(FEncodedBytes, OutStream, GetBytesFromAnsiString('1234567890'));
    OutStream.Seek(0, soFromBeginning);
 
    mmEncrypted.Lines.Text := 'The memo content is now decoded!';
    mmDecrypted.Lines.LoadFromStream(OutStream);
  finally
    OutStream.Free;
  end;
end;