base64编码与解码
假设有一个文件 example.txt
,其内容如下:
Hello, World!
可以使用以下命令将其编码为 Base64:
base64 example.txt > example_encoded.txt
编码后的 example_encoded.txt
内容如下:
SGVsbG8sIFdvcmxkIQo=
2. Base64 解码文件
将 Base64 编码的文件解码回原始内容:
base64 -d encodedfile > decodedfile
encodedfile
是要进行 Base64 解码的文件。decodedfile
是保存解码结果的文件。
直接在终端中进行编码和解码
base64 example.txt
SGVsbG8sIFdvcmxkIQo=
解码:
echo "SGVsbG8sIFdvcmxkIQo=" | base64 -d Hello, World!
本文来自博客园,作者:不会跳舞的胖子,转载请注明原文链接:https://www.cnblogs.com/rtnb/p/18336161