I have a BASE64 encode string:
static const unsigned char base64_test_enc[] =
"VGVzdCBzdHJpbmcgZm9yIGEgc3RhY2tvdmVyZmxvdy5jb20gcXVlc3Rpb24=";
It does not have CRLF-per-72 characters.
How to calculate a decoded message length?
Well, base64 represents 3 bytes in 4 characters... so to start with you just need to divide by 4 and multiply by 3.
You then need to account for padding:
"=="
you need to subtract 2 bytes (as the last group of 4 characters only represents 1 byte)"="
you need to subtract 1 byte (as the last group of 4 characters represents 2 bytes)See more on this question at Stackoverflow