ImageEn, unit imageenproc

TImageEnProc.Encrypt

TImageEnProc.Encrypt


Declaration

procedure Encrypt(const Passkey: AnsiString; Algorithm: TIEEncryptionAlgorithm = ieeaTEA);
procedure Encrypt(Passkey: array of byte; Algorithm: TIEEncryptionAlgorithm = ieeaTEA);


Description

Encrypts the current image (layer) using the Tiny Encryption Algorithm with a key of 128 bits:

en.wikipedia.org/wiki/Tiny_Encryption_Algorithm

Parameter Description
PassKey You can specify a string password, which will be hashed to a 128 bits key, or an array of bytes (a binary key of 16 bytes)
Algorithm Either ieeaTEA or ieeaTEA2. We recommend using ieeaTEA2 for better encryption

Warning: The image must be saved using a lossless format and in full rgb color spaces (no palette). If you use a lossy format such as JPEG you will not be able to decrypt the image.

Notes:
- To decrypt use Decrypt
- There is no way to know whether an image is encrypted, unless you insert special tags (like EXIF or IPTC) manually.


Example

ImageEnView1.IO.LoadFromFile('input.jpg');
ImageEnView1.Proc.Encrypt('captiva', ieeaTEA2);
ImageEnView1.IO.SaveToFile('crypted.png'); // Saving to lossless format


Demo

Demo  Demos\Other\Encrypt\Encrypt.dpr