Home  >  Article  >  Backend Development  >  php解密代码转换成c#代码

php解密代码转换成c#代码

WBOY
WBOYOriginal
2016-06-02 11:32:091822browse

phpc#

<code> function mymd5($string,$action="EN"){ //字符串加密和解密    global $webdb,$onlineip;//$webdb系统的一些配置信息,$onlineip 客户端ip 这个函数好像没有用到    $secret_string = $webdb[mymd5].'5*j,.^&;?.%#@!'; //绝密字符串,可以任意设定    //$webdb[mymd5] 可以自己设置一个字符串    if($string=="") return "";    if($action=="EN") $md5code=substr(md5($string),8,10); //动作是加密,则取明文的MD5码的 8到10位字符    else//动作是解密(DE)    {        $md5code=substr($string,-10);//取$string后10个字符        $string=substr($string,0,strlen($string)-10);//把$string倒数十个字符去掉    }    $key = md5($md5code.$secret_string);//密匙    $string = ($action=="EN"?$string:base64_decode($string));//如果动作是解密则将要解密的字符串进行MIME base64解码    $len = strlen($key);    $code = "";    for($i=0; $i<strlen .="$string[$i]^$key[$k];" : base64_encode return mymd5></strlen></code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn