wp/wp-includes/class-phpass.php
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
child 16 a86126ab1dd4
equal deleted inserted replaced
6:490d5cc509ed 7:cf61fcea0001
    37 	var $itoa64;
    37 	var $itoa64;
    38 	var $iteration_count_log2;
    38 	var $iteration_count_log2;
    39 	var $portable_hashes;
    39 	var $portable_hashes;
    40 	var $random_state;
    40 	var $random_state;
    41 
    41 
    42 	function PasswordHash($iteration_count_log2, $portable_hashes)
    42 	/**
       
    43 	 * PHP5 constructor.
       
    44 	 */
       
    45 	function __construct( $iteration_count_log2, $portable_hashes )
    43 	{
    46 	{
    44 		$this->itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
    47 		$this->itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
    45 
    48 
    46 		if ($iteration_count_log2 < 4 || $iteration_count_log2 > 31)
    49 		if ($iteration_count_log2 < 4 || $iteration_count_log2 > 31)
    47 			$iteration_count_log2 = 8;
    50 			$iteration_count_log2 = 8;
    48 		$this->iteration_count_log2 = $iteration_count_log2;
    51 		$this->iteration_count_log2 = $iteration_count_log2;
    49 
    52 
    50 		$this->portable_hashes = $portable_hashes;
    53 		$this->portable_hashes = $portable_hashes;
    51 
    54 
    52 		$this->random_state = microtime() . uniqid(rand(), TRUE); // removed getmypid() for compatibility reasons
    55 		$this->random_state = microtime() . uniqid(rand(), TRUE); // removed getmypid() for compatibility reasons
       
    56 	}
       
    57 
       
    58 	/**
       
    59 	 * PHP4 constructor.
       
    60 	 */
       
    61 	public function PasswordHash( $iteration_count_log2, $portable_hashes ) {
       
    62 		self::__construct( $iteration_count_log2, $portable_hashes );
    53 	}
    63 	}
    54 
    64 
    55 	function get_random_bytes($count)
    65 	function get_random_bytes($count)
    56 	{
    66 	{
    57 		$output = '';
    67 		$output = '';
   262 			$hash = crypt($password, $stored_hash);
   272 			$hash = crypt($password, $stored_hash);
   263 
   273 
   264 		return $hash === $stored_hash;
   274 		return $hash === $stored_hash;
   265 	}
   275 	}
   266 }
   276 }
   267 
       
   268 ?>