mirror of
https://github.com/c0de-archive/HashPass.git
synced 2024-12-22 03:32:40 +00:00
$i before $salt to keep things optional
My original version had $i after $salt and required a salt (which could have been '') in order to define $i. I changed that offline and in the HashPass demo to accept $i before $salt. If you only want one hashing, just send a 1 or '' Original call: hashpass($password, $salt_goes_here, 3); Better call: hashpass($password, 3, $salt_goes_here);
This commit is contained in:
parent
18dadeca00
commit
130da36c57
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* HashPass() function takes $plaintext, $salt and $i (number of iterations) as inputs and outputs $hashpass - $salt and $i are optional
|
/* HashPass() function takes $plaintext, $i and $salt (number of iterations) as inputs and outputs $hashpass - $salt and $i are optional
|
||||||
* Copyright David Todd (C) 2012
|
* Copyright David Todd (C) 2012
|
||||||
* http://www.unps-gama.info
|
* http://www.unps-gama.info
|
||||||
* This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
|
* This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.
|
||||||
@ -9,7 +9,7 @@
|
|||||||
* If no $plaintext provided, die with error message saved to error variable
|
* If no $plaintext provided, die with error message saved to error variable
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function hashpass($plaintext, $salt, $i){
|
function hashpass($plaintext, $i, $salt){
|
||||||
if($plaintext == null) die("No password detected"); // Append error into common error string for parsing later
|
if($plaintext == null) die("No password detected"); // Append error into common error string for parsing later
|
||||||
$plaintext = hash("sha1", $plaintext); // First step - get plaintext sha1
|
$plaintext = hash("sha1", $plaintext); // First step - get plaintext sha1
|
||||||
if($salt == null || $salt == ''){
|
if($salt == null || $salt == ''){
|
||||||
|
Loading…
Reference in New Issue
Block a user