@Stevie i'm still getting the same issue, but now I am receiving MMM MMMMMMMMMMMMMMMUMMMM
Full code:
[#include](https://forum.espruino.com/search/?q=%23include) <stdio.h> [#include](https://forum.espruino.com/search/?q=%23include) <string.h> [#include](https://forum.espruino.com/search/?q=%23include) <stdint.h> // Enable both ECB and CBC mode. Note this can be done before including aes.h or at compile-time. // E.g. with GCC by using the -D flag: gcc -c aes.c -DCBC=0 -DECB=1 [#define](https://forum.espruino.com/search/?q=%23define) CBC 1 [#define](https://forum.espruino.com/search/?q=%23define) ECB 0 //ECB is not a very secure cipher to use. [#include](https://forum.espruino.com/search/?q=%23include) "aes.h" [#include](https://forum.espruino.com/search/?q=%23include) "jswrap_crypto.h" [#include](https://forum.espruino.com/search/?q=%23include) "jsinteractive.h" static void test_encrypt_cbc(void); static void test_encrypt_cbc(void) { uint8_t key[] = { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c }; uint8_t iv[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }; uint8_t in[128] = { 0x7b, 0x22, 0x61, 0x72, 0x72, 0x61, 0x79, 0x22, 0x3a, 0x5b, 0x31, 0x2c, 0x32, 0x2c, 0x33, 0x5d, 0x2c, 0x22, 0x62, 0x6f, 0x6f, 0x6c, 0x65, 0x61, 0x6e, 0x22, 0x3a, 0x74, 0x72, 0x75, 0x65, 0x2c, 0x22, 0x6e, 0x75, 0x6c, 0x6c, 0x22, 0x3a, 0x6e, 0x75, 0x6c, 0x6c, 0x2c, 0x22, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x3a, 0x31, 0x32, 0x33, 0x2c, 0x22, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x22, 0x3a, 0x7b, 0x22, 0x61, 0x22, 0x3a, 0x22, 0x62, 0x22, 0x2c, 0x22, 0x63, 0x22, 0x3a, 0x22, 0x64, 0x22, 0x2c, 0x22, 0x65, 0x22, 0x3a, 0x22, 0x66, 0x22, 0x7d, 0x2c, 0x22, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x22, 0x3a, 0x22, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x22, 0x7d }; uint8_t buffer[128]; AES128_CBC_encrypt_buffer(buffer, in, 128, key, iv); int i; for(i = 0; i < 128; ++i) jsiConsolePrintf(in[i]); jsiConsolePrintf("\n"); jsiConsolePrint("CBC encrypt: "); }
1 Attachment
@d0773d started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
@Stevie i'm still getting the same issue, but now I am receiving
MMM MMMMMMMMMMMMMMMUMMMM
Full code:
1 Attachment