Password Hashing İşlevleri
PHP Manual

password_hash

(PHP 5 >= 5.5.0)

password_hashCreates a password hash

Açıklama

string password_hash ( string $password , integer $algo [, array $options ] )

password_hash() creates a new password hash.

Değiştirgeler

password

The user's password.

algo

A password algorithm constant denoting the algorithm to use when hashing the password.

options

An associative array containing options. Currently, two options are supported: salt, to provide a salt to use when hashing the password, and cost, which denotes the algorithmic cost that should be used. Examples of these values can be found on the crypt() page.

If omitted, a random salt will be created and the default cost will be used.

Dönen Değerler

Returns the hashed password, başarısızlık durumunda FALSE döner.

Örnekler

Örnek 1 password_hash() example

<?php
echo password_hash("rasmuslerdorf"PASSWORD_DEFAULT)."\n";

$options = [
    
'cost' => 7,
    
'salt' => 'BCryptRequires22Chrcts',
];
echo 
password_hash("rasmuslerdorf"PASSWORD_BCRYPT$options)."\n";
?>

Yukarıdaki örneğin çıktısı:

$2y$10$.vGA1O9wmRjrwAVXD98HNOgsNpDczlqm3Jq7KnEd1rVAGv3Fykk1a
$2y$07$BCryptRequires22Chrcte/VlQH0piJtjXl.0t1XkA8pw9dMXTpOq

Ayrıca Bakınız


Password Hashing İşlevleri
PHP Manual