'standard' base64 encode/decode?


#1

I see that MemoryBlock has ::fromBase64Encoding() and ::toBase64Encoding(); unfortunately, they seem to be JUCE specific implementations in that they prefix the strings with a length.  Before I go looking for another implementation, does JUCE offer a non-length-prefixed base64 encode/decode? I couldn't find one, but maybe its there and I missed it.

 


Cannot decode base64 in MemoryBlock from e.g. python base64 encoder
#2

I've meant to write one of those for a long time, but never quite got around to it! Probably quite trivial to find some code out there that will do it though.


#3

Thanks.  

I've been looking, so many of the samples are followed-up by comments that read like "you don't handle the case where ...", or "there is an out-of-bounds error under this condition...", so I don't have a lot of faith in them.  And for the most part, I dismiss the ones who's encode methods do not accept unsigned char[] (many only use char[]) as I don't want to deal with a sign-extension problem that they didn't consider.  And the reverse is true as well, decode should return unsigned char[], not char[].

I think I found a legit one, but, of course, it has an odd behavior in that it wants to insert '\n' every now and then for 'readablity'.  I'm working on it now.


#4

I've been working with a port of this..

 

http://iharder.sourceforge.net/current/java/base64/

 

..unfortunately not ported to anything to be of any use to you but it might be a stable reference point.