#!/usr/bin/perl -w sub npoint{ my $CodeStr = $_[0]; print $CodeStr.$/; my $CodeLen = 32; my $CodeSpace = $CodeLen - length($CodeStr); if ($CodeSpace >= 1){ $CodeStr .= chr(21) x $CodeSpace; } my $NewCode = 1; my @code = split(//,$CodeStr); my $count = 1; foreach (@code){ my $Been = 32 + ord($_)*$count; $NewCode *= $Been; $count +=1; } $CodeStr = uc($NewCode); $NewCode = ''; my $count2 = 0; while ($count2 < length($CodeStr)){ $NewCode .= &cfscode(substr($CodeStr,$count2,3)); $count2 += 1; } my $count3 = 19; my $final; while($count3<(length($NewCode)-18)){ $final .=substr($NewCode,$count3,1); $count3 +=2; } return $final; } sub cfscode{ my $word = $_[0]; my @word_list = split(//,$word); my $cfscode = ''; foreach(@word_list){ $cfscode .= ord($_) } return sprintf("%x",$cfscode); } print &npoint("admin");
原文地址:http://blog.csdn.net/adidala/article/details/42835345