View difference between Paste ID: fXpL1sbY and 7LKVGhMa
SHOW: | | - or go back to the newest paste.
1
// testing on http://sandbox.onlinephpfunctions.com/
2
3-
function yourls_phpass_instance( $iteration = 8, $portable = false ) {
3+
$stored_hash = '$2a$08$UbOIKE2oyh.shrjSkOJ3Au7zN2vqTkrhsmAFgaMPomfeS0S6xHjG6';
4-
	$iteration = yourls_apply_filter( 'phpass_new_instance_iteration', $iteration );
4+
$password = 'phpass';
5-
	$portable  = yourls_apply_filter( 'phpass_new_instance_portable', $portable );
5+
6
$crypt = crypt($password, $stored_hash);
7-
	static $instance = false;
7+
8-
	if( $instance == false ) {
8+
var_dump( $crypt );
9-
		$instance = new PasswordHash( $iteration, $portable );
9+
var_dump( $crypt == $stored_hash ); // should be true