Base64 implementation for JavaScript