intrbiz / arduino-crypto

A minimal crypto library for ESP8266 Arduino
Other
140 stars 54 forks source link

Error on AES 128 16bytes chain #14

Closed MxMantoHI closed 4 years ago

MxMantoHI commented 6 years ago

I are very interesting on AES128 to encrypt my msg but some msg finish trunked, by example with this datas (below), the result are a65cba889bbe05632e00000000000000 (hex)and are trunked after 2e with 00000000. Unlike with any modification on msg or even iv, then make correct encrypttation...(correct result for example a65cba889bbe05632e0563e00c991e42268f8 using php)

char key1[]="clavePrivada1111"; char iv1[]="ye3BPck9nawMhLmM"; char data[] = "OK015=1111110110";

void encrypt(char plain_text, char output, int length){ byte enciphered[length]; AES aesEncryptor(key, iv, AES::AES_MODE_128, AES::CIPHER_ENCRYPT); aesEncryptor.process((uint8_t)plain_text, enciphered, length); int encrypted_size = sizeof(enciphered); char encoded[encrypted_size]; strcpy(output, (char)enciphered); }

thank's so much for this minute, i hope help us,