is there any function or library that can encode data using base64 encoding..? in nrf51422
is there any function or library that can encode data using base64 encoding..? in nrf51422
Hi,
Take a look at the ARM crypto lib (GPL license) or implement it directly from the RFC here. It is quite a simple procedure, more about re-grouping bits than anything else.
HI ulrich myhre i used the .h and .c files that you have privided to encode and then decode my data. the array to be encoded is {0x00 ,0x35 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x35}; after encoding i get this string "ADUAAAAAAAAA" and to check encoding when i pass this string to my decode function the result i got was wrong. it changed the 12th byte which is 0x35 to 0x00.then is shifted my 0x35 byte to every position in array and it only works upto 9th position.after that it converts 0x35 to 0x00.
When encoding to base64, the output size will increase by a factor of about 4/3. This is because every 3 bytes are encoded into 4 bytes, and finally padded to always be a multiple of 4 bytes. So the destination array needs to be larger. A more precise size than 4/3 is (src_length + 2 - ((src_length + 2) % 3)) / 3 * 4. You should then get that your string encodes into "ADUAAAAAAAAAADU=", which is reversed properly back to your start array.
Dead Link : ARM crypto lib