在linux上处理base64加密和解密

http://snailwarrior.blog.51cto.com/680306/142472/

2.从标准输入读取文件内容,base64编码并打印到标准输出

[root@localhost test]# base64
snailwarrior
c25haWx3YXJyaW9yCg==

我是输入snailwarrior,回车,然后按Ctrl+D结束文件输入的。

3、对字符串"snailwarrior"编码,并打印到标准输出

[root@localhost test]# echo "snailwarrior" | base64
c25haWx3YXJyaW9yCg==

4、Base64解码

[root@localhost test]# echo "snailwarrior" | base64 | base64 -d
snailwarrior
base64: invalid input

http://www.centoscn.com/CentosBug/osbug/2013/0813/1229.html

RHEL5自带的base64工具有BUG,base64解码时莫名出错:base64: invalid input。
使用源码包编译安装:

wget http://www.fourmilab.ch/webtools/base64/base64-1.5.tar.gz
tar zxf base64-1.5.tar.gz
cd base64-1.5
./configure
make && make -n install

base64 -d gfwlist.txt gfwlist_base64.txt

这个东西的配置似乎不对,还是不行

不过可以在解压后的路径里直接处理

[root@localhost base64-1.5]# echo "snailwarrior" | ./base64 | ./base64 -d
snailwarrior

这里的base64-1.5是文件夹

原文地址:https://www.cnblogs.com/chucklu/p/5186254.html