Encode digest to base64