adamvr/arduino-base64

Source is being modified.

facetime88 opened this issue · 1 comments

Hi there,

Sorry that I am new in arduino.
I just make a test as follow:

uint8_t key[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
char data[] = "0123456789012345";
aes256_enc_single(key, data);
Serial.println(data);
Serial.println(data);
char output[base64_enc_len(sizeof(data))];
//base64_encode(output, data, sizeof(data));
aes256_dec_single(key, data);
Serial.print("decrypted:");
Serial.println(data);

This will be output correctly (the decryption is successful)

�⸮⸮⸮⸮�s⸮�B⸮ ⸮3⸮O
�⸮⸮⸮⸮�s⸮�B⸮ ⸮3⸮O
decrypted:0123456789012345

But when include back the function base64_encode(output, data, strlen(data)); it makes the decryption failed.

Kf⸮⸮eh@⸮⸮⸮I⸮⸮f⸮�
Kf⸮⸮eh@⸮⸮⸮I⸮⸮f⸮�
decrypted:⸮�⸮`:Q⸮⸮c⸮D ,⸮|⸮

Seems the encoder make some modification to the input data.
Am I missing something here..?
Thanks.

I faced the same issue and identified two issues which I fixed in the example code, see pull request #23
See also my #12 (comment)