php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #60813 Implement PBKDF2 function in hash
Submitted: 2012-01-19 22:00 UTC Modified: 2013-06-24 00:54 UTC
Votes:4
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (50.0%)
From: ircmaxell@php.net Assigned: ircmaxell (profile)
Status: Closed Package: hash related
PHP Version: trunk-SVN-2012-01-19 (snap) OS: All
Private report: No CVE-ID: None
 [2012-01-19 22:00 UTC] ircmaxell@php.net
Description:
------------
I propose to implment a PBKDF2 derivation function in the hash package as 
hash_pbkdf2().  PBKDF2 is defined in PKCS#5 (RFC 2898).  The method for password 
hash derivation is currently used by Blackberry, Apple iOS, Microsoft, OpenOffice, 
and more (not all for password storage, but all for password based hashing).

The patch also cleans up hash_hmac a little bit to split out some common 
functionality into a few inline functions (since PBKDF2 relies heavily on hmac).

Test script:
---------------
<?php

echo hash_pbkdf2('sha1', 'password', 'salt', 1, 20) . "\n\n";
echo hash_pbkdf2('sha256', 'password', 'salt', 10000, 64) . "\n\n";


Expected result:
----------------
0c60c80f961f0e71f3a9

5ec02b91a4b59c6f59dd5fbe4ca649ece4fa8568cdb8ba36cf41426e8805522


Patches

hash_pbkdf2 (last revision 2012-01-19 22:00 UTC by ircmaxell)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-06-12 17:47 UTC] ircmaxell@php.net
This has been submitted as a pull request. RFC to follow:

https://github.com/php/php-src/pull/105
 [2013-06-24 00:54 UTC] ircmaxell@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: ircmaxell
 [2013-06-24 00:54 UTC] ircmaxell@php.net
Implemented in 5.5.0
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 04:01:28 2024 UTC