A script language of step-sharing scheduling coroutine in single thread
This is a library function for AES encryption and decryption.
aes = Import('aes');
aes.aes(data, key, bits, op);
Input:
bits – an integer value of the key bit length. Key’s’ bit-length must be equal to or greater than bits. It supports these value: 128, 192, 256.
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