Форум программистов
 

Восстановите пароль или Зарегистрируйтесь на форуме, о проблемах и с заказом рекламы пишите сюда - alarforum@yandex.ru, проверяйте папку спам!

Вернуться   Форум программистов > Web программирование > SQL, базы данных
Регистрация

Восстановить пароль
Повторная активизация e-mail

Купить рекламу на форуме - 42 тыс руб за месяц

Ответ
 
Опции темы Поиск в этой теме
Старый 01.02.2014, 00:01   #1
Govers
 
Регистрация: 09.04.2012
Сообщений: 6
По умолчанию Шифрование phpbb

Столкнулся с проблемой, необходимо реализовать интеграцию одной игры с форумом рhpbb на таком примере уже реализованным
для вордпрес:
Код:
Код:
function hash_wordpress()
{
  global $realPass, $postPass;
  $cryptPass = false;
  $itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
  $count_log2 = strpos($itoa64, $realPass[3]);
  $count = 1 << $count_log2;
  $salt = substr($realPass, 4, 8);
  $input = md5($salt . $postPass, TRUE);
  do $input = md5($input . $postPass, TRUE);
  while (--$count);        
  $output = substr($realPass, 0, 12);
  $count = 16;
  $i = 0;
  do
  {
   $value = ord($input[$i++]);
   $cryptPass .= $itoa64[$value & 0x3f];
   if ($i < $count) $value |= ord($input[$i]) << 8;
   $cryptPass .= $itoa64[($value >> 6) & 0x3f];
   if ($i++ >= $count) break;
   if ($i < $count) $value |= ord($input[$i]) << 16;
   $cryptPass .= $itoa64[($value >> 12) & 0x3f];
   if ($i++ >= $count) break;
   $cryptPass .= $itoa64[($value >> 18) & 0x3f];
  } while ($i < $count);
  $cryptPass = $output . $cryptPass;
  return $cryptPass;
}
для дле
  global $postPass;
  $cryptPass = false;
  $cryptPass = md5(md5($postPass));
  return $cryptPass;

Нашёл в includes/functions.php строки отвечающие за шифрование
* Hash the password
*/
function phpbb_hash($password)
{
$itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';

$random_state = unique_id();
$random = '';
$count = 6;

if (($fh = @fopen('/dev/urandom', 'rb')))
{
  $random = fread($fh, $count);
  fclose($fh);
}

if (strlen($random) < $count)
{
  $random = '';

  for ($i = 0; $i < $count; $i += 16)
  {
   $random_state = md5(unique_id() . $random_state);
   $random .= pack('H*', md5($random_state));
  }
  $random = substr($random, 0, $count);
}

$hash = _hash_crypt_private($password, _hash_gensalt_private($random, $itoa64), $itoa64);

if (strlen($hash) == 34)
{
  return $hash;
}

return md5($password);
}

/**
* Check for correct password
*
* @param string $password The password in plain text
* @param string $hash The stored password hash
*
* @return bool Returns true if the password is correct, false if not.
*/
function phpbb_check_hash($password, $hash)
{
if (strlen($password) > 4096)
{
  // If the password is too huge, we will simply reject it
  // and not let the server try to hash it.
  return false;
}

$itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
if (strlen($hash) == 34)
{
  return (_hash_crypt_private($password, $hash, $itoa64) === $hash) ? true : false;
}

return (md5($password) === $hash) ? true : false;
}

/**
* Generate salt for hash generation
*/
function _hash_gensalt_private($input, &$itoa64, $iteration_count_log2 = 6)
{
if ($iteration_count_log2 < 4 || $iteration_count_log2 > 31)
{
  $iteration_count_log2 = 8;
}

$output = '$H$';
$output .= $itoa64[min($iteration_count_log2 + ((PHP_VERSION >= 5) ? 5 : 3), 30)];
$output .= _hash_encode64($input, 6, $itoa64);

return $output;
}

/**
* Encode hash
*/
function _hash_encode64($input, $count, &$itoa64)
{
$output = '';
$i = 0;

do
{
  $value = ord($input[$i++]);
  $output .= $itoa64[$value & 0x3f];

  if ($i < $count)
  {
   $value |= ord($input[$i]) << 8;
  }

  $output .= $itoa64[($value >> 6) & 0x3f];

  if ($i++ >= $count)
  {
   break;
  }

  if ($i < $count)
  {
   $value |= ord($input[$i]) << 16;
  }

  $output .= $itoa64[($value >> 12) & 0x3f];

  if ($i++ >= $count)
  {
   break;
  }

  $output .= $itoa64[($value >> 18) & 0x3f];
}
while ($i < $count);

return $output;
}

/**
Но как не пробывал не помогает.
Govers вне форума Ответить с цитированием
Ответ


Купить рекламу на форуме - 42 тыс руб за месяц

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск


Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
изменение путей в phpBB Антон Ос Помощь студентам 2 05.07.2013 15:09
Проблемы с ПМ на phpbb Tip.the.besT Работа с сетью в Delphi 1 20.01.2013 09:27
PhpBB и программирование Кузнецоw Фриланс 3 09.02.2011 16:10
Распознавание капчи phpBB Оптимист2009 Свободное общение 11 03.07.2009 09:33