加密函数Str_Encrypt AS3和PHP版本对照

时间:13-05-01 栏目:网站开发 作者:admin 评论:0 点击: 4,772 次

加密函数:Str_Encrypt ActionScript3.0版本

function Str_Encrypt(Post_Str) {
        if (wasSuccessful) {
            var _local2 = new String(Post_Str).split(",");
            var _local3 = new String(",").split(",");
            var _local7 = Number(_local2[2].substr(0, 1));
            var _local6 = Number(_local2[2].substr(3, 1));
            var _local1 = 0;
            while (_local1 < _local2[0].length) {
                var _local4 = _local2[0].substr(_local1, 1);
                var _local5 = Ey_str.indexOf(_local4);
                if (_local5 == -1) {
                    _local3[0] = _local3[0] + _local4;
                } else {
                    _local3[0] = _local3[0] + Em_str[_local7].substr(_local5, 1);
                }
                _local1++;
            }
            _local1 = 0;
            while (_local1 < _local2[1].length) {
                var _local4 = _local2[1].substr(_local1, 1);
                var _local5 = Ey_str.indexOf(_local4);
                if (_local5 == -1) {
                    _local3[1] = _local3[1] + _local4;
                } else {
                    _local3[1] = _local3[1] + Em_str[_local6].substr(_local5, 1);
                }
                _local1++;
            }
            return((((_local3[0] + ",") + _local3[1]) + ",") + _local2[2]);
        } else {
            return("err");
        }
}
    var _method = "Str_Encrypt";
    var e_area = null;
    var method = Str_Encrypt;
    var wasSuccessful = flash.external.ExternalInterface.addCallback(_method, e_area, method);
    var Ey_str = "0123456789abcdefghijklmnopqrstuvwxyz";
    var Em_str = new Array();
    Em_str[0] = "xyi0grm9as78vhzu6k234lef1pqcw5ojtdnb";
    Em_str[1] = "vxyi0gr6kq4lef1pobm9a23s78hzcw5djtnu";
    Em_str[2] = "q4l78k23f1potnhzcudjyi0gr6bvxm9aw5se";
    Em_str[3] = "f1q4ldjpotnhi0grawbvxm9e5s3u78k2zc6y";
    Em_str[4] = "nh3zu78kc6ytf1aq4ldjpowbvxm9i0gre5s2";
    Em_str[5] = "um92re5snh3z678kcqytf1gvxaowb4ldjpi0";
    Em_str[6] = "re5swbao8kum91gvxc2nh3z67fdjpi0qyt4l";
    Em_str[7] = "ao8re5kusyt4nh3zwbxc2m910qgv67fdjpil";
    Em_str[8] = "5axc2m67f0qgvildjpkusywbnh3z91o8ret4";
    Em_str[9] = "7ldjpk8ruvixf05aqg3z9cnet41hwbo2m6sy";
    // unexpected jump
    // unexpected jump

加密函数:Str_Encrypt PHP版本

function Str_Encrypt($Post_Str){
		$Ey_str = "0123456789abcdefghijklmnopqrstuvwxyz";
		$Em_str = array();
		$Em_str[0] = "xyi0grm9as78vhzu6k234lef1pqcw5ojtdnb";
		$Em_str[1] = "vxyi0gr6kq4lef1pobm9a23s78hzcw5djtnu";
		$Em_str[2] = "q4l78k23f1potnhzcudjyi0gr6bvxm9aw5se";
		$Em_str[3] = "f1q4ldjpotnhi0grawbvxm9e5s3u78k2zc6y";
		$Em_str[4] = "nh3zu78kc6ytf1aq4ldjpowbvxm9i0gre5s2";
		$Em_str[5] = "um92re5snh3z678kcqytf1gvxaowb4ldjpi0";
		$Em_str[6] = "re5swbao8kum91gvxc2nh3z67fdjpi0qyt4l";
		$Em_str[7] = "ao8re5kusyt4nh3zwbxc2m910qgv67fdjpil";
		$Em_str[8] = "5axc2m67f0qgvildjpkusywbnh3z91o8ret4";
		$Em_str[9] = "7ldjpk8ruvixf05aqg3z9cnet41hwbo2m6sy";

		$_local2 = explode(",",$Post_Str);
		$_local3 = explode(",",",");
		$_local7 = intval(substr($_local2[2],0, 1));
		$_local6 = intval(substr($_local2[2],3, 1));
		$i = 0;
		while ($i < strlen($_local2[0])) {
			$_local4 = substr($_local2[0],$i, 1);
			$_local5 = strpos($Ey_str,$_local4);
			if ($_local5 == false) {
				$_local3[0] = $_local3[0] . $_local4;
			} else {
				$_local3[0] = $_local3[0] . substr($Em_str[$_local7],$_local5, 1);
			}
		   $i++;
		}
		$i = 0;
		while ($i < strlen($_local2[1])) {
			$_local4 = substr($_local2[1],$i, 1);
		   $_local5 = strpos($Ey_str,$_local4);
			if ($_local5 == false) {
				$_local3[1] = $_local3[1] . $_local4;
			} else {
				$_local3[1] = $_local3[1] . substr($Em_str[$_local6],$_local5, 1);
			}
			$i++;
		}
		return(((($_local3[0] . ",") . $_local3[1]) . ",") . $_local2[2]);

	}

附另一个解密函数:

function sTE($T){
		$Ey_str = "0123456789abcdefghijklmnopqrstuvwxyz";
   		$Em_str =  array();
		$Em_str[0] = "xyi0grm9as78vhzu6k234lef1pqcw5ojtdnb";
		$Em_str[1] = "vxyi0gr6kq4lef1pobm9a23s78hzcw5djtnu";
		$Em_str[2] = "q4l78k23f1potnhzcudjyi0gr6bvxm9aw5se";
		$Em_str[3] = "f1q4ldjpotnhi0grawbvxm9e5s3u78k2zc6y";
		$Em_str[4] = "nh3zu78kc6ytf1aq4ldjpowbvxm9i0gre5s2";
		$Em_str[5] = "um92re5snh3z678kcqytf1gvxaowb4ldjpi0";
		$Em_str[6] = "re5swbao8kum91gvxc2nh3z67fdjpi0qyt4l";
		$Em_str[7] = "ao8re5kusyt4nh3zwbxc2m910qgv67fdjpil";
		$Em_str[8] = "5axc2m67f0qgvildjpkusywbnh3z91o8ret4";
		$Em_str[9] = "7ldjpk8ruvixf05aqg3z9cnet41hwbo2m6sy";
		$N_Txt = "";
		$i = 0;
		while ($i < strlen($T)) {
			$VC_I = $i;
			if ($VC_I > 9) {
				$VC_I = 0;
			}
			$t_Str = substr($T,$i, 1);
			$Ey_Index = strpos($Ey_str,$t_Str);
			if ($Ey_Index ===false) {
				$N_Txt = $N_Txt . $t_Str;
			} else {
				$N_Txt = $N_Txt . substr($Em_str[$VC_I], $Ey_Index, 1);
			}
			$i++;
		}	
		return $N_Txt;
	}

声明: 本文由( admin )原创编译,转载请保留链接: 加密函数Str_Encrypt AS3和PHP版本对照

加密函数Str_Encrypt AS3和PHP版本对照:等您坐沙发呢!

发表评论


------====== 本站公告 ======------
联系信息:
lxq73061#qq.com qq:583964941
支付宝:https://me.alipay.com/lxq73061
相关插件程序等信息均会在站内发布,敬请关注。

读者排行