password_get_info

(PHP 5 >= 5.5.0)

password_get_infoReturns information about the given hash

Description

array password_get_info ( string $hash )

When passed in a valid hash created by an algorithm supported by password_hash(), this function will return an array of information about that hash.

Parameters

hash

A hash created by password_hash().

Return Values

Returns an associative array with three elements:

Коментарии

If you're curious to use this method to determine if there is someway to evaluate if a given string is NOT a password_hash() value...

<?php

// Our password.. the kind of thing and idiot would have on his luggage:
$password_plaintext "12345";

// Hash it up, fuzzball!
$password_hash password_hash$password_plaintextPASSWORD_DEFAULT, [ 'cost' => 11 ] );

// What do we get?
print_rpassword_get_info$password_hash ) );

/* returns:
Array ( 
    [algo] => 1 
    [algoName] => bcrypt  // Your server's default.
    [options] => Array ( [cost] => 11 ) 
)
*/

// What about if it's un-hashed?...
print_rpassword_get_info$password_plaintext ) );

/* returns:
Array ( 
    [algo] => 0 
    [algoName] => unknown 
    [options] => Array ( ) 

*/
?>

... Looks like it's up to each of us to personally decide if it's safe to compare against the final returned array.
2017-07-31 04:23:57
http://php5.kiev.ua/manual/ru/function.password-get-info.html

    Поддержать сайт на родительском проекте КГБ