Ejemplo n.º 1
0
function passport_decrypt($txt, $key)
{
    $txt = passport_key(base64_decode($txt), $key);
    $tmp = '';
    for ($i = 0; $i < strlen($txt); $i++) {
        $md5 = $txt[$i];
        $tmp .= $txt[++$i] ^ $md5;
    }
    return $tmp;
}
Ejemplo n.º 2
0
function _passport_decrypt($txt)
{
    $key = 'dfsy74yt9fayp34htoayw98rth4oeuto8p4e';
    $txt = passport_key(base64_decode($txt), $key);
    $tmp = '';
    for ($i = 0; $i < strlen($txt); $i++) {
        $md5 = $txt[$i];
        $tmp .= $txt[++$i] ^ $md5;
    }
    return $tmp;
}
Ejemplo n.º 3
0
function passport_encrypt($txt, $key)
{
    srand((double) microtime() * 1000000);
    $encrypt_key = md5(rand(0, 32000));
    $ctr = 0;
    $tmp = '';
    for ($i = 0; $i < strlen($txt); $i++) {
        $ctr = $ctr == strlen($encrypt_key) ? 0 : $ctr;
        $tmp .= $encrypt_key[$ctr] . ($txt[$i] ^ $encrypt_key[$ctr++]);
    }
    return base64_encode(passport_key($tmp, $key));
}
Ejemplo n.º 4
0
 function saedisk_decrypt($txt, $key = '<yiis>')
 {
     $dir = $this->get_sae_root();
     $txt = $dir . $txt;
     return $txt;
     $txt = passport_key(base64_decode($txt), $key);
     $tmp = '';
     for ($i = 0; $i < strlen($txt); $i++) {
         $md5 = $txt[$i];
         $tmp .= $txt[++$i] ^ $md5;
     }
     return $tmp;
 }
Ejemplo n.º 5
0
/**
* Passport 解密函数
*
* @param		string		加密后的字串
* @param		string		私有密匙(用于解密和加密)
*
* @return	string		字串经过私有密匙解密后的结果
*/
function passport_decrypt($txt, $key)
{
    // $txt 的结果为加密后的字串经过 base64 解码,然后与私有密匙一起,
    // 经过 passport_key() 函数处理后的返回值
    $txt = passport_key(base64_decode($txt), $key);
    // 变量初始化
    $tmp = '';
    // for 循环,$i 为从 0 开始,到小于 $txt 字串长度的整数
    for ($i = 0; $i < strlen($txt); $i++) {
        // $tmp 字串在末尾增加一位,其内容为 $txt 的第 $i 位,
        // 与 $txt 的第 $i + 1 位取异或。然后 $i = $i + 1
        $tmp .= $txt[$i] ^ $txt[++$i];
    }
    // 返回 $tmp 的值作为结果
    return $tmp;
}
Ejemplo n.º 6
0
 /**
  * 字符串解密函数
  * @param string $txt
  * @param string $key
  * @return string
  */
 function passport_decrypt($txt, $key = 'Mlover-Moerlove-Com-2015')
 {
     $txt = passport_key(base64_decode($txt), $key);
     $tmp = '';
     for ($i = 0; $i < strlen($txt); $i++) {
         if (empty($txt[$i + 1])) {
             return false;
         }
         $md5 = $txt[$i];
         $tmp .= $txt[++$i] ^ $md5;
     }
     return $tmp;
 }