add a base64 implementation (based on FreeBSD code)