加密,将file1加密成file2文件
tr "[a-m][n-z]" "[n-z][a-m]" < file1 > file2
解密,使用原参数将file2文件解密为原文件file1
tr "[a-m][n-z]" "[n-z][a-m]" < file2 > file1
# cat test1
hello world!
good luck!
# tr "[a-m][n-z]" "[n-z][a-m]" < test1 > test2
# cat test2
uryyb jbeyq!
tbbq yhpx!
# tr "[a-m][n-z]" "[n-z][a-m]" < test2 > test3
# cat test3
hello world!
good luck!
同理可以设置数字加密
tr "[0-4][5-9]" "[5-9][0-4]" < file1 > file2
tr "[0-4][5-9]" "[5-9][0-4]" < file2 > file1
混合加密
tr "[a-m][n-z][A-M][N-Z][0-4][5-9]" "[n-z][a-m][N-Z][A-M][5-9][0-4]" < file1 > file2
tr "[a-m][n-z][A-M][N-Z][0-4][5-9]" "[n-z][a-m][N-Z][A-M][5-9][0-4]" < file2 > file1
阅读(2632) | 评论(0) | 转发(0) |