base64: get rid of strtok_r and use strspn+strcspn instead

strtok_r is not available on win32 and the designated strtok_s
function is reported to not work on windows xp. Hence we use an
easier an non-destructive implementation with strspn and strcspn
to strip out the whitespace.