array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'tr', ), 'this' => array ( 0 => 'function.openssl-pbkdf2.php', 1 => 'openssl_pbkdf2', ), 'up' => array ( 0 => 'ref.openssl.php', 1 => 'OpenSSL İşlevleri', ), 'prev' => array ( 0 => 'function.openssl-open.php', 1 => 'openssl_open', ), 'next' => array ( 0 => 'function.openssl-pkcs12-export-to-file.php', 1 => 'openssl_pkcs12_export_to_file', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/openssl/functions/openssl-pbkdf2.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5 >= 5.5.0, PHP 7, PHP 8)
openssl_pbkdf2 — Generates a PKCS5 v2 PBKDF2 string
$password
,$salt
,$key_length
,$iterations
,$digest_algo
= "sha1"openssl_pbkdf2() computes PBKDF2 (Password-Based Key Derivation Function 2), a key derivation function defined in PKCS5 v2.
password
Password from which the derived key is generated.
salt
PBKDF2 recommends a crytographic salt of at least 64 bits (8 bytes).
key_length
Length of desired output key.
iterations
The number of iterations desired. » NIST recommends at least 10,000.
digest_algo
Optional hash or digest algorithm from openssl_get_md_methods(). Defaults to SHA-1.
Returns raw binary string başarısızlık durumunda false
döner.
Örnek 1 openssl_pbkdf2() example
<?php
$password = 'password';
$salt = openssl_random_pseudo_bytes(16);
$keyLength = 20;
$iterations = 600000;
$generated_key = openssl_pbkdf2($password, $salt, $keyLength, $iterations, 'sha256');
echo bin2hex($generated_key)."\n";
echo base64_encode($generated_key)."\n";
?>