AES is the Advanced Encryption Standard, also known as Rijndael. This is a modern block cipher, recently standardized. It processes data by blocks of 128 bits (16 bytes), and supports keys of 128, 192 or 256 bits. The string argument is the key; it must have length 16, 24 or 32. The direction argument specifies whether encryption or decryption is to be performed.
The optional mode
argument specifies a chaining mode, as described above; CBC
is used by default.
The optional pad
argument specifies a padding scheme to pad cleartext to an integral number of blocks. If no pad
argument is given, no padding is performed and the length of the cleartext must be an integral number of blocks.
The optional iv
argument is the initialization vector used by the chaining mode. It is ignored in ECB mode. If provided, it must be a string of the same size as the block size (16 bytes). If omitted, the null initialization vector (16 zero bytes) is used.
The aes
function returns a transform that performs encryption or decryption, depending on the direction argument.