adamvr / arduino-base64

A base64 library for the arduino platform, written in C
MIT License
184 stars 102 forks source link

Source is being modified. #21

Open facetime88 opened 7 years ago

facetime88 commented 7 years ago

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.

palto42 commented 6 years ago

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)