mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52:10 +09:00
#266 zbxe에서 비밀번호 체크시 memberModel::isValidPassword(hashes, plain)을 이용하면 md5, mysql password/old_password에 대한 검사를 할 수 있게 하여 마이그레이션 된 게시글/댓글의 비밀번호 검사도 가능하도록 변경
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3007 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
4624c74dbd
commit
d4c6825802
5 changed files with 64 additions and 73 deletions
|
|
@ -395,4 +395,32 @@
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief mysql old_password 의 php 구현 함수
|
||||
* 제로보드4나 기타 mysql4.1 이전의 old_password()함수를 쓴 데이터의 사용을 위해서
|
||||
* mysql의 password.c 소스 참조해서 구현함
|
||||
**/
|
||||
function mysql_pre4_hash_password($password) {
|
||||
$nr = 1345345333;
|
||||
$add = 7;
|
||||
$nr2 = 0x12345671;
|
||||
|
||||
settype($password, "string");
|
||||
|
||||
for ($i=0; $i<strlen($password); $i++) {
|
||||
if ($password[$i] == ' ' || $password[$i] == '\t') continue;
|
||||
$tmp = ord($password[$i]);
|
||||
$nr ^= ((($nr & 63) + $add) * $tmp) + ($nr << 8);
|
||||
$nr2 += ($nr2 << 8) ^ $nr;
|
||||
$add += $tmp;
|
||||
}
|
||||
$result1 = sprintf("%08lx", $nr & ((1 << 31) -1));
|
||||
$result2 = sprintf("%08lx", $nr2 & ((1 << 31) -1));
|
||||
|
||||
if($result1 == '80000000') $nr += 0x80000000;
|
||||
if($result2 == '80000000') $nr2 += 0x80000000;
|
||||
|
||||
return sprintf("%08lx%08lx", $nr, $nr2);
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue