Have you considered using haxe.crypto.BaseCode instead of maintaining your own base64 implementation?