pbkdf2 암호화 함수 적용

This commit is contained in:
thisgun committed 2018-10-11 09:59:42 +09:00
1 parent cb29c398cc
commit 352cf06944
5 files changed
+260 -3

No files matched your search

+34
View File
@@ -1,6 +1,8 @@
<?php
if (!defined('_GNUBOARD_')) exit;
include_once(dirname(__FILE__) .'/pbkdf2.compat.php');
/*************************************************************************
**
** 일반 함수 모음
@@ -3023,11 +3025,43 @@ function get_encrypt_string($str)
// 비밀번호 비교
function check_password($pass, $hash)
{
if(defined('G5_STRING_ENCRYPT_FUNCTION') && G5_STRING_ENCRYPT_FUNCTION === 'create_hash') {
return validate_password($pass, $hash);
}
$password = get_encrypt_string($pass);
return ($password === $hash);
}
// 로그인 패스워드 체크
function login_password_check($mb, $pass, $hash)
{
global $g5;
$mb_id = isset($mb['mb_id']) ? $mb['mb_id'] : '';
if(!$mb_id)
return false;
if(G5_STRING_ENCRYPT_FUNCTION === 'create_hash' && strlen($hash) === G5_MYSQL_PASSWORD_LENGTH) {
if( sql_password($pass) === $hash ){
if( ! isset($mb['mb_password2']) ){
$sql = "ALTER TABLE `{$g5['member_table']}` ADD `mb_password2` varchar(255) NOT NULL default '' AFTER `mb_password`";
sql_query($sql);
}
$new_password = create_hash($pass);
$sql = " update {$g5['member_table']} set mb_password = '$new_password', mb_password2 = '$hash' where mb_id = '$mb_id' ";
sql_query($sql);
return true;
}
}
return check_password($pass, $hash);
}
// 동일한 host url 인지
function check_url_host($url, $msg='', $return_url=G5_URL, $is_redirect=false)
{