rfc:hash_pbkdf2
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
rfc:hash_pbkdf2 [2012/07/02 16:32] – Open voting for hash_pbkdf2 ircmaxell | rfc:hash_pbkdf2 [2017/09/22 13:28] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Request for Comments: Adding hash_pbkdf2 Function ====== | ====== Request for Comments: Adding hash_pbkdf2 Function ====== | ||
- | * Version: | + | * Version: |
* Date: 2012-06-13 | * Date: 2012-06-13 | ||
* Author: Anthony Ferrara < | * Author: Anthony Ferrara < | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
Line 57: | Line 57: | ||
This parameter behaves just like the other *hash_* functions. If set to *true*, the function will return a binary string (chr 0-255). If set to *false*, the function will hex encode the result prior to returning it. | This parameter behaves just like the other *hash_* functions. If set to *true*, the function will return a binary string (chr 0-255). If set to *false*, the function will hex encode the result prior to returning it. | ||
+ | |||
+ | ===== Example ===== | ||
+ | |||
+ | Let's say you wanted to encrypt a file using a password. The password shouldn' | ||
+ | |||
+ | <file php encryption.php> | ||
+ | <?php | ||
+ | $password = " | ||
+ | $data = " | ||
+ | $salt = mcrypt_create_iv(16, | ||
+ | $key = hash_pbkdf2(" | ||
+ | // $key will be full-byte 0-255 data | ||
+ | |||
+ | $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, | ||
+ | |||
+ | $ciphertext = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, | ||
+ | ?> | ||
+ | </ | ||
+ | |||
+ | Or for storing passwords (BCrypt is recommended, | ||
+ | <file php password.php> | ||
+ | <?php | ||
+ | $password = " | ||
+ | $salt = mcrypt_create_iv(16, | ||
+ | $hash = hash_pbkdf2(" | ||
+ | |||
+ | // $hash will be a hex encoded string | ||
+ | ?> | ||
+ | </ | ||
+ | |||
===== Proposal and Patch ===== | ===== Proposal and Patch ===== | ||
Line 73: | Line 103: | ||
< | < | ||
- | title=" | + | title=" |
* Yes? | * Yes? | ||
* No? | * No? | ||
Line 90: | Line 120: | ||
* 0.3 - Added Parameter Information | * 0.3 - Added Parameter Information | ||
* 0.4 - Reworded to target master only, removing 5.4 section | * 0.4 - Reworded to target master only, removing 5.4 section | ||
+ | * 1.0 - Moving to Accepted state |
rfc/hash_pbkdf2.1341246754.txt.gz · Last modified: 2017/09/22 13:28 (external edit)