public static function checkPassword($rawPassword, $hashedPassword)
{
- if (!$rawPassword || !$hashedPassword)
+ if (!$rawPassword || !$hashedPassword || strpos($hashedPassword, ':') === false)
return false;
list($algo, $salt, $hash) = explode(':', $hashedPassword);
return $hash === $algo($salt . $rawPassword);
--- /dev/null
+<?php
+
+class Crypto_Test extends PHPUnit_Framework_TestCase
+{
+ public function testRecording()
+ {
+ $this->assertFalse(IPF_Crypto::checkPassword('secret', 'badhash'));
+ }
+}