phpsecPw::age
- phpsec
| Versions | |
|---|---|
| b-0.1 | public static phpsecPw::age($dbPassword) |
Check the age of a salted password.
Parameters
string $dbPassword The json string fetched from the database, in the exact format as created by phpsecPw::hash().
Return value
integer Age of password in seconds.
Code
phpsec/
<?php
public static function age($dbPassword) {
$data = json_decode($dbPassword, true);
if (isset($data['salt'])) {
$date = substr($data['salt'], 0, 22);
return gmdate('U') - strtotime($date);
}
else {
/* Invalid array supplied. */
self::error('Invalid data supplied. Expected serialized array as returned by pwHash()');
}
return false;
}
?> Copyright (c) 2011, 2012 Audun Larsen.
Drupal theme by Kiwi Themes.
