全球主机交流论坛

标题: whmcs 密码加解密方式 [打印本页]

作者: lcy    时间: 2018-11-19 13:17
标题: whmcs 密码加解密方式
function encrypt($string)
{
    $applicationConfig = DI::make("config");
    $cc_encryption_hash = $applicationConfig["cc_encryption_hash"];
    $key = md5(md5($cc_encryption_hash)) . md5($cc_encryption_hash);
    $hash_key = _hash($key);
    $hash_length = strlen($hash_key);
    $iv = _generate_iv();
    $out = "";
    for( $c = 0; $c < $hash_length; $c++ )
    {
        $out .= chr(ord($iv[$c]) ^ ord($hash_key[$c]));
    }
    $key = $iv;
    for( $c = 0; $c < strlen($string); $c++ )
    {
        if( $c != 0 && $c % $hash_length == 0 )
        {
            $key = _hash($key . substr($string, $c - $hash_length, $hash_length));
        }

        $out .= chr(ord($key[$c % $hash_length]) ^ ord($string[$c]));
    }
    return base64_encode($out);
}

function decrypt($string)
{
    $applicationConfig = DI::make("config");
    $cc_encryption_hash = $applicationConfig["cc_encryption_hash"];
    $key = md5(md5($cc_encryption_hash)) . md5($cc_encryption_hash);
    $hash_key = _hash($key);
    $hash_length = strlen($hash_key);
    $string = base64_decode($string);
    $tmp_iv = substr($string, 0, $hash_length);
    $string = substr($string, $hash_length, strlen($string) - $hash_length);
    $iv = "";
    $out = "";
    for( $c = 0; $c < $hash_length; $c++ )
    {
        $ivValue = (isset($tmp_iv[$c]) ? $tmp_iv[$c] : "");
        $hashValue = (isset($hash_key[$c]) ? $hash_key[$c] : "");
        $iv .= chr(ord($ivValue) ^ ord($hashValue));
    }
    $key = $iv;
    for( $c = 0; $c < strlen($string); $c++ )
    {
        if( $c != 0 && $c % $hash_length == 0 )
        {
            $key = _hash($key . substr($out, $c - $hash_length, $hash_length));
        }

        $out .= chr(ord($key[$c % $hash_length]) ^ ord($string[$c]));
    }
    return $out;
}

有大佬了解么?

作者: 1827617524    时间: 2019-4-20 16:24
基本上都是md5,base64那些加密的,解密工具百度就有
作者: qq674684107    时间: 2019-4-20 21:44
百度能找到加解密的网站。




欢迎光临 全球主机交流论坛 (https://loc.mjj8.eu.org/) Powered by Discuz! X3.4