need base64 encode/decode in c

11,702

Solution 1

Get the functions from libb64.

Solution 2

If you have openssl available to you (which most *nix distros seem to have out-of-the-box these days), it provides robust, well-tested base64 encoding/decoding out of the box. This site has a decent code sample: Howto base64 decode with C/C++ and OpenSSL

Share:
11,702
Admin
Author by

Admin

Updated on June 11, 2022

Comments

  • Admin
    Admin almost 2 years

    I need a function to encode base64 and a function to decode base64 string in c. I found http://base64.sourceforge.net/b64.c but the functions work on files, not strings, and add line breaks. I need one that simply encodes/decodes strings. Where can I find such a sourcecode?

  • Lothar
    Lothar about 9 years
    Including a monster like OpenSSL for a 150 line solution, this is the sad way of programming these days