如何将文本转换为 phpbb 哈希?
我正在尝试将测试密码 (testing4) 转换为 phpbb3 哈希值。这是我尝试过的代码:
<?php
/**
*
* @package phpBB3
* @version $Id: v3_dbal.xml 44 2007-07-25 11:06:55Z smithy_dll $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
define('IN_PHPBB', true);
include ("functions_phpbb.php");
$data['new_password'] = "testing4";
$user_row = array(
'user_password' => phpbb_hash($data['new_password'])
);
$hash = $user_row['user_password'];
echo $hash;
?>
这也不起作用:
$pass = "testing4";
$hash = phpbb_hash($pass);
两次我都收到以下错误消息:
Fatal error: Call to a member function sql_escape() on a non-object in /home/a8544020/public_html/Pass/functions_phpbb.php on line 149
我在两个不同的主机上尝试过,但没有任何运气。否则是否有一个在线服务可以简单地将文本转换为哈希值?
提前致谢
I am trying to convert a test password (testing4) into a phpbb3 hash. This is the code I have tried:
<?php
/**
*
* @package phpBB3
* @version $Id: v3_dbal.xml 44 2007-07-25 11:06:55Z smithy_dll $
* @copyright (c) 2005 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/
define('IN_PHPBB', true);
include ("functions_phpbb.php");
$data['new_password'] = "testing4";
$user_row = array(
'user_password' => phpbb_hash($data['new_password'])
);
$hash = $user_row['user_password'];
echo $hash;
?>
and this doesn't work either:
$pass = "testing4";
$hash = phpbb_hash($pass);
Both times I recieve the following error message:
Fatal error: Call to a member function sql_escape() on a non-object in /home/a8544020/public_html/Pass/functions_phpbb.php on line 149
I have tried it on 2 different hosts without any luck. Otherwise is there an online service that simply converts text to the hash?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我假设您的
functions_phpbb.php
文件是 phpBB3 包的includes/functions.php
文件的副本。现在,您收到此错误的原因是
phpbb_hash
函数使用 phpBBunique_id
函数来获取熵,这取决于数据库连接(以更改并保留熵)每个请求)。有两种方法可以解决这个问题。
a) 包含 phpBB 的
common.php
,它将引导您的 phpBB 代码(包括数据库连接、错误处理程序等)。b) phpBB3 使用 phpass 进行哈希处理。我建议您只需下载独立的 phpass 包并使用它来生成哈希值。
小警告:phpBB3 将哈希标识符从 '$P$' 更改为 '$H$' (不要问我为什么),所以你必须将这一行更改
:由于选项 a) 增加了相当多的开销,并且您可能只想使用散列函数,我建议选项 b)。
;为
:由于选项 a) 增加了相当多的开销,并且您可能只想使用散列函数,我建议选项 b)。
I'm assuming your
functions_phpbb.php
file is a copy of theincludes/functions.php
file of the phpBB3 package.Now, the reason you are getting this error is because the
phpbb_hash
function uses the phpBBunique_id
function for entropy, which depends on a database connection (to change and persist the entropy on every request).There's two ways to fix this.
a) include phpBB's
common.php
, which will bootstrap your code for phpBB (including db connection, error handlers, etc).b) phpBB3 uses phpass for hashing. I suggest you simply download the standalone phpass package and use that to generate the hash.
Little caveat: phpBB3 changes the hash identifier from '$P$' to '$H$' (don't ask me why), so you will have to change this line:
Since option a) adds quite some overhead, and you are probably only wanting to use the hashing functions, I'd suggest option b).
;to:
Since option a) adds quite some overhead, and you are probably only wanting to use the hashing functions, I'd suggest option b).
也许是另一种方式。我使用了以下库:http://www.openwall.com/phpass/工作时,您必须更改生成的 HASH 的前 3 个字符:
以
在 phpbb 中使用
Maybe the other way. I have used the library from: http://www.openwall.com/phpass/ To make it working, you must change first 3 characters of generated HASH:
to
used in phpbb
我想知道为什么他们通过 SQL 转义函数运行密码哈希。但你可以简单地尝试将该函数定义为虚拟函数:
I wonder why they run a password hash through a SQL escaping function.. but you could simply try defining that function as a dummy: