码迷,mamicode.com
首页 > 编程语言 > 详细

perl实现N点虚拟主机管理系统加密算法

时间:2015-01-18 14:24:58      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:perl   n点虚拟主机   加密   

#!/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");

perl实现N点虚拟主机管理系统加密算法

标签:perl   n点虚拟主机   加密   

原文地址:http://blog.csdn.net/adidala/article/details/42835345

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!