Skip to content

Commit

Permalink
use hash_equals (#90)
Browse files Browse the repository at this point in the history
* use hash_equals

* keep support for php <5.6

* add missing return statement
  • Loading branch information
lalop authored and ruben-haegeman committed Apr 30, 2019
1 parent eefe735 commit 9050e50
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/Ogone/DirectLink/CreateAliasResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ class CreateAliasResponse extends AbstractResponse
*/
public function isValid(ShaComposer $shaComposer)
{
return $shaComposer->compose($this->parameters) == $this->shaSign;
if (function_exists('hash_equals')) {
return hash_equals($shaComposer->compose($this->parameters), $this->shaSign);
} else {
return $shaComposer->compose($this->parameters) == $this->shaSign;
}
}

public function isSuccessful()
Expand Down
6 changes: 5 additions & 1 deletion lib/Ogone/Ecommerce/EcommercePaymentResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ class EcommercePaymentResponse extends AbstractPaymentResponse
*/
public function isValid(ShaComposer $shaComposer)
{
return $shaComposer->compose($this->parameters) == $this->shaSign;
if (function_exists('hash_equals')) {
return hash_equals($shaComposer->compose($this->parameters), $this->shaSign);
} else {
return $shaComposer->compose($this->parameters) == $this->shaSign;
}
}
}

0 comments on commit 9050e50

Please sign in to comment.