#Este Source Sirve para encriptar un String en distintas formas #ASCCI, HEX, Hex_url, MD5, SHA1 #Modo de uso: perl script.pl palabra_a_encriptar #!/usr/bin/perl use Digest::MD5 qw(md5_hex md5_base64); use Digest::SHA1 qw(sha1_hex sha1_base64); my $str = $ARGV[0]; #String to ASCCI @array_ascci = split (//,$str); foreach $i (@array_ascci) { $ascci = $ascci . ord($i) . ","; } chop ($ascci); print "ASCCI:\t\t$ascci\n"; #String to HEX print "HEX:\t\t0x"; print unpack('H*', "$str"); print "\n"; #String to Hex URL print "HEX_URL:\t"; @array_hex = split (//,$str); foreach $i (@array_hex) { $hex_url = $hex_url . unpack('H*', "$i") . "%"; ; } chop ($hex_url); print "$hex_url\n\n"; #String to MD5 my $md5 = Digest::MD5->new(); $md5 = md5_hex($str); print "MD5:\t\t$md5\n"; $md5 = md5_base64($str); print "MD5_Base64:\t$md5\n\n"; #String to SHA1 my $sha1 = Digest::SHA1->new(); $sha1 = sha1_hex($str); print "SHA1:\t\t$sha1\n"; $sha1 = sha1_base64($str); print "SHA1_Base64:\t$sha1\n";
Modo de uso