如何将文本转换为phpbb哈希? [英] How to convert text to phpbb hash?
问题描述
我试图将一个测试密码(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公共许可证
*
* /
/ **
* @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);
两次我收到以下错误消息:
致命错误:调用149行中的/home/a8544020/public_html/Pass/functions_phpbb.php中的非对象上的成员函数sql_escape()调用
我在2台不同的主机上尝试过,没有任何运气。否则有没有一个在线服务,简单地将文本转换为散列?
预先感谢
我假设你的 functions_phpbb.php
文件是 includes / functions.php $ c $的副本c> phpBB3软件包的文件。
现在,您遇到此错误的原因是因为 phpbb_hash
函数使用phpBB unique_id
函数实现熵,这取决于数据库连接(在每个请求中更改并保留熵)。
有两种方法可以解决这个问题。
a)包括phpBB的 common.php
,它将启动你的phpBB代码(包括数据库连接,错误处理程序等)。
$ b b)phpBB3使用 phpass 进行散列。我建议你只需下载独立的phpass包并使用它来生成散列。
小小警告:phpBB3将散列标识符从'$ P $'更改为'$ H $'(不要问我为什么),所以你必须改变这一行:
$ output ='$ P $;
到:
$ output ='$ H $';
由于选项a)增加了一些开销,并且您可能只想使用散列函数,我建议选项b)。
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
I'm assuming your functions_phpbb.php
file is a copy of the includes/functions.php
file of the phpBB3 package.
Now, the reason you are getting this error is because the phpbb_hash
function uses the phpBB unique_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:
$output = '$P$';
to:
$output = '$H$';
Since option a) adds quite some overhead, and you are probably only wanting to use the hashing functions, I'd suggest option b).
这篇关于如何将文本转换为phpbb哈希?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!