Skip to content

Commit

Permalink
Better debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
tigerhawkvok committed Apr 25, 2014
1 parent 8fc4436 commit bcef5b3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions php-stronghash.php
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,10 @@ private function strbool($bool)

public function verifyHash($hash,$orig_data,$orig_salt=null,$orig_algo=null,$orig_rounds=null,$debug=false)
{
$was_array = false;
if(is_array($orig_data))
{
$was_array = true;
$refhash=$orig_data;
$orig_salt=$orig_data['salt'];
$orig_algo=$orig_data['algo'];
Expand All @@ -323,8 +325,9 @@ public function verifyHash($hash,$orig_data,$orig_salt=null,$orig_algo=null,$ori

if($debug===true)
{
$match= $hash_compare==$refhash['hash'] ? true:false;
return array("pw_hashed"=>$hash,"pw_compare"=>$hash_compare,"data"=>$refhash,"match"=>strbool($match));
$match= $hash_compare==$refhash['hash'];
$match_slow = $this->slow_equals($hash_compare,$refhash['hash']);
return array("pw_hashed"=>$refhash['hash'],"pw_compare"=>$hash_compare,"data"=>$refhash,"match"=>$match,"slow_match"=>$match_slow,"basehash"=>$refhash,"was_array"=>$was_array);
}

if($refhash[0]!==false) return $this->slow_equals($hash_compare,$refhash['hash']);
Expand Down

0 comments on commit bcef5b3

Please sign in to comment.