ImageEn, unit iexUtils

IEDecryptString

IEDecryptString

Declaration

function IEDecryptString(const S, Password: String; Algorithm: TIEHashAlgorithm): String;

Description

Decrypt a Base64 encoded string string that was encrypted using IEEncryptString.

Note:
Generally an exception is not raised if the specified password is incorrect (except in the case below). So you should use a different method to validate the data
An exception will be raised if the data returned by decryption cannot be mapped to a unicode string (e.g. if due to a bad password the returned data is corrupted)

Example

var
  InText, EncText, OutText, PW: string;
begin
  PW := 'This is my Password';
  InText := 'This is a test!';

  // Encrypt text using SHA256
  EncText := IEEncryptString( InText, PW, iehaSHA256 );
  Memo1.Lines.Add( '"' + EncText + '"' );

  // Decrypt text using SHA256
  OutText := IEDecryptString( EncText, PW, iehaSHA256 );
  Memo1.Lines.Add( '"' + OutText + '"' );
end;

See Also

IEEncryptString
DecryptString
TIEHashStream