Home  Contents

aes:encrypt

Cipher Core4 Lua Commands

SYNOPSIS

  1. ciphertext = aes:encrypt(plaintext)
  2. plaintext = aes:decrypt(ciphertext)

DESCRIPTION

Encryption or decryption of a single block of 16 bytes. This is the most basic AES operation. The passed string must be exactly 16 bytes long, the block size of the AES algorithm.

aes must be an AES state handle as returned by cipher.aes(). The handle must have it's key initialized using aes:setupEncrypt() or aes:setupDecrypt().

RETURN VALUE

A string of 16 bytes, containing the encryption or decryption result.

ERRORS

Raises an error aes is not an AES state handle or if the passed argument is not a string of 16 bytes length.

NOTES

This is probably not what you want. Better use cipher block chaining mode or padded mode, which is more secure.

SEE ALSO