在c中需要base64编码/解码

时间:2022-12-02 23:25:53

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?

我需要一个函数来编码base64和一个函数来解码c中的base64字符串。我找到了http://base64.sourceforge.net/b64.c,但这些函数适用于文件,而不是字符串,并添加换行符。我需要一个简单的编码/解码字符串。我在哪里可以找到这样的源代码?

2 个解决方案

#1


2  

Get the functions from libb64.

从libb64获取函数。

#2


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

如果你有openssl可用(大多数* nix发行版似乎现在已经开箱即用),它提供了强大的,经过良好测试的base64编码/解码开箱即用。这个站点有一个不错的代码示例:如何使用C / C ++和OpenSSL进行base64解码

#1


2  

Get the functions from libb64.

从libb64获取函数。

#2


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

如果你有openssl可用(大多数* nix发行版似乎现在已经开箱即用),它提供了强大的,经过良好测试的base64编码/解码开箱即用。这个站点有一个不错的代码示例:如何使用C / C ++和OpenSSL进行base64解码