几种常见的cms密码加密方式

upload (Van Helsing) | 2013-02-03 15:10

1.Discuz:

$pw = md5(md5($password).$salt);

2.74cms(骑士CMS):

$password_hash=md5(md5($password).$pwd_hash.$QS_pwdhash);  

其中:

$pwd_hash=randstr();

$QS_pwdhash=randstr(16);


代码:

function randstr($length=6)

{

$hash='';

$chars= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz@#!~?:-=';

$max=strlen($chars)-1;  

mt_srand((double)microtime()*1000000);  

for($i=0;$i<$length;$i++)   {  

$hash.=$chars[mt_rand(0,$max)];  

}  

return $hash;  

}


3.phpcms-php

$salt = substr(uniqid(rand()), -6);

$password = md5(md5($password).$salt);

注:uniqid() 函数基于以微秒计的当前时间,生成一个唯一的 ID


4.dedecms-php

$password = $row['pwd'];

$pwd = substr($password, 5, 20);


5.EmpireCMS(帝国CMS):

提供三种加密方式:

$user_dopass=0;//密码保存形式,0为md5,1为明码,2为双重加密,3为16位md5

..

....

.....

if(empty($user_dopass))//单重md5

{

  $password=md5($password);

  $oldpassword=md5($oldpassword);

}

elseif($user_dopass==2)//双重md5

{

  $salt=make_password($user_saltnum);

  $password=md5(md5($password).$salt);

  $sa=",".$user_salt."='$salt'";

}

elseif($user_dopass==3)//16位md5

{

    $password=substr(md5($password),8,16);

    $oldpassword=substr(md5($oldpassword),8,16);

}