Base64 compat

Added code teo make base64 encoding and decoding compatible with non-Linux. Left Linux implementation in case it runs faster than the second one. If not, it can be removed.