您的位置:首页 > 其它

产生随机文件并加解密

2015-05-15 11:15 176 查看
因测试需要,需对随机文件并加解密

[root@test]# cat /dev/urandom | sed 's/[^a-zA-Z0-9]//g' | strings -n 8|head -n 10

q09zp7Zw

0T75nYDY

HGRl2A0Dk

J21n5sqX

lS7bPTWvT

OAgVNQxbyL

t5Tsp0cj

AnXbKScQ

6h4M9Q7Cf

iqnH3BvCt

产生一个8个随机字符串,10行的文件

[root@test]# cat /dev/urandom | sed 's/[^a-zA-Z0-9]//g' | strings -n 8|head -n 10 >test.txt

[root@test]# cat test.txt

zt2DLBRH

EkBiFyi6

ScfAzUak

g46Dbgs8

9Du9Dsno

4zqHwJU1

GYkDkvXm

ZqgFoql8

6fJVyBbZM        

K0Vk4ibK

加密文件

# gpg -c test.txt

             +-----------------------------------------------------+

| Enter passphrase |

| |

| |

| Passphrase ____________________ |

| |

| <OK> <Cancel> |

+-----------------------------------------------------+

生成test.txt.gpg

rm test.txt

解密

gpg test.txt.gpg
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: