note 119850 added to function.hash-pbkdf2

From: Date: Tue, 06 Sep 2016 08:40:59 +0000
Subject: note 119850 added to function.hash-pbkdf2
Groups: php.notes 
Request: Send a blank email to php-notes+get-206509@lists.php.net to get a copy of this message
Please pay great attention to the **$length** parameter! It is exactly the **return string length**, NOT the length of raw binary hash result. I had a big problem about this -- I thought that hash_pbkdf2(...false) should equals to bin2hex(hash_pbkdf2(...true)) just like md5($x) equals bin2hex(md5($x, true)). However I was wrong: hash_pbkdf2('sha256', '123456', 'abc', 10000, 50, false); // returns string(50) "584bc5b41005169f1fa15177edb78d75f9846afc466a4bae05" hash_pbkdf2('sha256', '123456', 'abc', 10000, 50, true); // returns string(50) "XKŴ��Qw�u��j�FjK���BFW�YpG �mp.g2�`;N�" bin2hex(hash_pbkdf2('sha256', '123456', 'abc', 10000, 50, true)); // returns string(100) "584bc5b41005169f1fa15177edb78d75f9846afc466a4bae05119c82424657c81b5970471f098a6d702e6732b7603b194efe" So I add such a note. Hope it will help someone else like me. ---- Server IP: 72.52.91.14 Probable Submitter: 58.213.24.130 ---- Manual Page -- http://php.net/manual/en/function.hash-pbkdf2.php Edit -- https://master.php.net/note/edit/119850 Del: integrated -- https://master.php.net/note/delete/119850/integrated Del: useless -- https://master.php.net/note/delete/119850/useless Del: bad code -- https://master.php.net/note/delete/119850/bad+code Del: spam -- https://master.php.net/note/delete/119850/spam Del: non-english -- https://master.php.net/note/delete/119850/non-english Del: in docs -- https://master.php.net/note/delete/119850/in+docs Del: other reasons-- https://master.php.net/note/delete/119850 Reject -- https://master.php.net/note/reject/119850 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#206509) next »