pbkdf2 암호화 적용

This commit is contained in:
thisgun committed 2018-10-22 17:53:38 +09:00
1 parent e40344fe96
commit 866f49ec47
9 files changed
+328 -47

No files matched your search

+38
View File
@@ -1,6 +1,8 @@
<?php
if (!defined('_GNUBOARD_')) exit;
include_once(dirname(__FILE__) .'/pbkdf2.compat.php');
/*************************************************************************
**
** 일반 함수 모음
@@ -354,6 +356,10 @@ function get_list($write_row, $board, $skin_url, $subject_len=40)
else
$list['subject'] = conv_subject($list['wr_subject'], $board['bo_subject_len'], '…');
if( ! (isset($list['wr_seo_title']) && $list['wr_seo_title']) && $list['wr_id'] ){
seo_title_update(get_write_table_name($board['bo_table']), $list['wr_id'], 'bbs');
}
// 목록에서 내용 미리보기 사용한 게시판만 내용을 변환함 (속도 향상) : kkal3(커피)님께서 알려주셨습니다.
if ($board['bo_use_list_content'])
{
@@ -3110,11 +3116,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)
{