常用加密算法使用

MD5使用

使用md5对字符串加密

perl 中的md5

需要安装md5包

yum -y install perl-Digest-MD5

test.pl文件内容

#!/usr/bin/perl
use strict;
use Digest::MD5 qw(md5_hex);
my $md5str=md5_hex("123X");
$md5str=~ tr [a-z] [A-Z];
print "md5str: $md5str \n";

执行

[root@chain test]# perl test.pl
md5str: 807CD73ADE610130A51A5AAEF97D9E55

Linux 系统使用MD5

[root@chain test]# echo -n '123X'|md5sum|cut -d ' ' -f1 | tr 'a-z' 'A-Z'
807CD73ADE610130A51A5AAEF97D9E55

AIX 系统使用MD5

这里使用了openssl

printf '123X' | openssl dgst -md5 | tr 'a-z' 'A-Z'
(STDIN)=807CD73ADE610130A51A5AAEF97D9E55

猜你喜欢

转载自blog.csdn.net/u010895512/article/details/123909275