Melang

Logo

A script language of time-sharing scheduling coroutine in single thread

View the Project on GitHub Water-Melon/Melang

AES

This is a library function for AES encryption and decryption.

Import

aes = Import('aes');

Functions

aes

aes.aes(data, key, bits, op);

Input:

Return value:

Error:

Example:

aes = Import('aes');
sys = Import('sys');
str = Import('str');

text = 'This is an aes test, note length';
sys.print('text length: '+str.strlen(text));
key = 'this is a secret';
cipher = aes.aes(text, key, 128, 'encode');
sys.print(cipher);
text = aes.aes(cipher, key, 128, 'decode');
sys.print(text);

The output is:

text length: 32
l???<??J? ?H?D???j?8?!??B#?8
This is an aes test, note length