Method AesCrypt():new() Professional

Creates an instance of the AesCrypt class.

AesCrypt():new([<cKey>|<oKey>], [<nMode>]) --> oAesCrypt
The encryption buffer is prepared by passing the key. The key is used to encrypt and decrypt the data. The length of the key must be either 128, 192 or 256 bit. <cKey> is interpreted as a binary character string. If this parameter is not passed, it must later be set by calling :setKey().
Alternativly, an object of the class SecureKey() can be passed as the key. If this parameter is not passed, it must later be set by calling :setKey().
Sets the crypting operation mode. Possible values are CRYPT_OP_ECB, CRYPT_OP_CBC and CRYPT_OP_CTS. The default value is CRYPT_OP_ECB.
Operation modes
nMode Operation mode name Minimal result size
CRYPT_OP_ECB Electronic CodeBook one block
CRYPT_OP_CBC Cipher Block Chaining two blocks
CRYPT_OP_CTS CBC combined with cipher text stealing two blocks

The class method :new() returns an AesCrypt object.


If :new() is called with no parameters, the method :setKey() must be called before the instance can be used to encrypt or decrypt data.

The the fastest operation mode is ECB.


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.