SA-MP Forums Archive
WhirlPool Hash on PHP - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Other (https://sampforum.blast.hk/forumdisplay.php?fid=7)
+--- Forum: Everything and Nothing (https://sampforum.blast.hk/forumdisplay.php?fid=23)
+--- Thread: WhirlPool Hash on PHP (/showthread.php?tid=515949)



WhirlPool Hash on PHP - Mriss - 28.05.2014

How would I Whirlpool Hash this ( Login Script)
PHP код:
$account $model->getUser($input["user"], $input["pass"]) 



Re: WhirlPool Hash on PHP - Isolated - 28.05.2014

PHP код:
hash("whirlpool"$string); 
PHP код:
$account $model->getUser($input["user"], hash("whirlpool"$input["pass"])) 
http://us2.php.net/manual/en/function.hash.php


Respuesta: WhirlPool Hash on PHP - JustBored - 28.05.2014

http://lmgtfy.com/?q=Whirpool+hash+in+PHP


Re: WhirlPool Hash on PHP - Mriss - 28.05.2014

SO do I just place that code right under the other?
and Do I need to change the $string in the hash function to anything or leave it?


Re: WhirlPool Hash on PHP - Isolated - 28.05.2014

Re-read my post. I've updated it.

Something that could make your life easier would be creating a hash class then using that class for salts also.


Re: WhirlPool Hash on PHP - Mark_Weston - 28.05.2014

Here is an example of what I did;

Код:
if (isset($_POST['UserName'])) {
  $loginUsername=$_POST['UserName'];
  $password=$_POST['Password'];
  $password = strtoupper(hash("whirlpool",$password));
  $MM_fldUserAuthorization = "playerMDCLevel";
  $MM_redirectLoginSuccess = "cpanel.php";
  $MM_redirectLoginFailed = "errors.php?ErrorID=2";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_lspd, $lspd);
There are 100000 other ways to do it. (don't copy mine code as it won't work with yours.


Re: WhirlPool Hash on PHP - Isolated - 28.05.2014

Quote:
Originally Posted by Mark_Weston
Посмотреть сообщение
Here is an example of what I did;

Код:
if (isset($_POST['UserName'])) {
  $loginUsername=$_POST['UserName'];
  $password=$_POST['Password'];
  $password = strtoupper(hash("whirlpool",$password));
  $MM_fldUserAuthorization = "playerMDCLevel";
  $MM_redirectLoginSuccess = "cpanel.php";
  $MM_redirectLoginFailed = "errors.php?ErrorID=2";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_lspd, $lspd);
There are 100000 other ways to do it. (don't copy mine code as it won't work with yours.
If your using mysql then you shouldn't be coding PHP. A good developer will always keep up to date with new syntax. You should be using mysqli.


Re: WhirlPool Hash on PHP - Calgon - 29.05.2014

As other people have said, use the hash() function. However, you should make sure you capitalize the string using strtoupper(). The SA-MP Whirlpool plugin capitalizes all strings, and you'll prevent any inconsistencies by matching the cases.

Quote:
Originally Posted by Isolated
Посмотреть сообщение
If your using mysql then you shouldn't be coding PHP. A good developer will always keep up to date with new syntax. You should be using mysqli.
This is a pointless thing to say. There is nothing wrong with the old MySQL code, some people write better code in procedural.


Re: WhirlPool Hash on PHP - Joe Staff - 29.05.2014

Quote:
Originally Posted by Calgon
Посмотреть сообщение
The SA-MP Whirlpool capitalizes all strings
Why would a hash not be case-sensitive? This seems wrong to men, or do you mean the hashed string is all caps?


Re: WhirlPool Hash on PHP - Calgon - 29.05.2014

Quote:
Originally Posted by Joe Staff
Посмотреть сообщение
Why would a hash not be case-sensitive? This seems wrong to men, or do you mean the hashed string is all caps?
The hashed string from the Whirlpool plugin is in uppercase, and PHP's hash() function returns the hashed string in lowercase?..