Topic

FAQ
Login Register
AES implementation code
Jul 14, 2022 18:31

/

A

/A

I tried implementing AES functions but also after reading the SDK and a lot of trials, several things are not clear.


How should I pass the string to be encrypted to aes_encrypt? As char array containing char(s) o char array containint equivalent hexadecimal numbers?

The resulting char array contains char(s) or hexadecimal numbers?


I've already tried to encrypt a string and then decrypt it both with different online tools (set with AES128 ECB) and with aes_decrypt, and I can never get back the original string.


Has anyone got a piece of code that can be used as example?


Thank you!


2 replies
TL_Soyo Jul 18, 2022 10:08
0
/A

Hi,


char key[17] = "ciaociaociaociao";
char data[17];
char chypertext[17];
int check ;
char plaintext[17];
void main_loop (void)
{
check = aes_encrypt(key, data, chypertext);
check += aes_decrypt(key, chypertext, plaintext);
sleep_ms(500);
gpio_toggle(LED1|LED2|LED3|LED4);
}

we test it on this link(https://the-x.cn/cryptography/Aes.aspx) is fine,you can use translation software to use . 

Mattia [Author] Jul 19, 2022 16:01
0
/A

Thank you!