在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是文件夾

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM