How do I encode a string to base64 using only boost?

前端 未结 9 1036
南方客
南方客 2020-12-04 10:53

I\'m trying to quickly encode a simple ASCII string to base64 (Basic HTTP Authentication using boost::asio) and not paste in any new code code or use any libraries beyond bo

9条回答
  •  Happy的楠姐
    2020-12-04 11:37

    You could use beast's implementation.

    For boost version 1.71, the functions are:

    boost::beast::detail::base64::encode()
    boost::beast::detail::base64::encoded_size()
    boost::beast::detail::base64::decode()
    boost::beast::detail::base64::decoded_size()
    

    From #include

    For older versions back to beast's inclusion in 1.66, the functions are:

    boost::beast::detail::base64_encode()
    boost::beast::detail::base64_decode()
    

    From #include

提交回复
热议问题