TCipher.GetRC5

Creates new TCipher instance implementing customized RC5 algorithm


Syntax

class function TCipher.GetRC5(AAlgID: TAlgID; BlockSize, Rounds: Cardinal): TCipher; static;

Remarks

Examples

Encrypt file with RC5 algorithm having 128-bit block size and 20 rounds in CBC mode of operation:

uses
  tfArrays, tfCiphers;

procedure EncryptCBC(const FileName: string; const Key, IV: ByteArray);
var
  Cipher: TCipher;

begin
  Cipher:= TCipher.GetRC5(CBC_ENCRYPT, 16, 20);
  try
    Cipher.Init(Key, IV)
          .EncryptFile(FileName, FileName + '.rc5');
  finally
    Cipher.Burn;
  end;
end;