-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Create hash_pbkdf2 function addition #105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6387498
Create hash_pbkdf2 function addition
ircmaxell 550253f
Update NEWS to fix typo, add name
ircmaxell 4918acc
refactor away un-necessary casts in hashing routines
ircmaxell df3d351
Update error messages to be more inline with PHP standards
ircmaxell 43eb8dc
Remove un-needed memset, and replacing stray spaces
ircmaxell 2f1cd2c
Fix tests to use proper casing
ircmaxell 03536e8
More cleanup of documentation and comments, as well as code formatting
ircmaxell 731c6fd
Merge remote branch 'upstream/master' into hash_pbkdf2
ircmaxell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--TEST-- | ||
Test hash_pbkdf2() function : basic functionality | ||
--SKIPIF-- | ||
<?php extension_loaded('hash') or die('skip: hash extension not loaded.'); ?> | ||
--FILE-- | ||
<?php | ||
|
||
/* Prototype : string hash_hmac ( string $algo , string $data , string $key [, bool $raw_output ] ) | ||
* Description: Generate a keyed hash value using the HMAC method | ||
* Source code: ext/hash/hash.c | ||
* Alias to functions: | ||
*/ | ||
|
||
echo "*** Testing hash_pbkdf2() : basic functionality ***\n"; | ||
|
||
echo "sha1: " . hash_pbkdf2('sha1', 'password', 'salt', 1, 20)."\n"; | ||
echo "sha1(raw): " . bin2hex(hash_pbkdf2('sha1', 'password', 'salt', 1, 20, TRUE))."\n"; | ||
echo "sha1(rounds): " . hash_pbkdf2('sha1', 'passwordPASSWORDpassword', 'saltSALTsaltSALTsaltSALTsaltSALTsalt', 4096, 25)."\n"; | ||
echo "sha1(rounds)(raw): " . bin2hex(hash_pbkdf2('sha1', 'passwordPASSWORDpassword', 'saltSALTsaltSALTsaltSALTsaltSALTsalt', 4096, 25, TRUE))."\n"; | ||
echo "sha256: " . hash_pbkdf2('sha256', 'password', 'salt', 1, 20)."\n"; | ||
echo "sha256(raw): " . bin2hex(hash_pbkdf2('sha256', 'password', 'salt', 1, 20, TRUE))."\n"; | ||
echo "sha256(rounds): " . hash_pbkdf2('sha256', 'passwordPASSWORDpassword', 'saltSALTsaltSALTsaltSALTsaltSALTsalt', 4096, 40)."\n"; | ||
echo "sha256(rounds)(raw): " . bin2hex(hash_pbkdf2('sha256', 'passwordPASSWORDpassword', 'saltSALTsaltSALTsaltSALTsaltSALTsalt', 4096, 40, TRUE))."\n"; | ||
|
||
?> | ||
===Done=== | ||
--EXPECT-- | ||
*** Testing hash_pbkdf2() : basic functionality *** | ||
sha1: 0c60c80f961f0e71f3a9 | ||
sha1(raw): 0c60c80f961f0e71f3a9b524af6012062fe037a6 | ||
sha1(rounds): 3d2eec4fe41c849b80c8d8366 | ||
sha1(rounds)(raw): 3d2eec4fe41c849b80c8d83662c0e44a8b291a964cf2f07038 | ||
sha256: 120fb6cffcf8b32c43e7 | ||
sha256(raw): 120fb6cffcf8b32c43e7225256c4f837a86548c9 | ||
sha256(rounds): 348c89dbcbd32b2f32d814b8116e84cf2b17347e | ||
sha256(rounds)(raw): 348c89dbcbd32b2f32d814b8116e84cf2b17347ebc1800181c4e2a1fb8dd53e1c635518c7dac47e9 | ||
===Done=== |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a leftover
)
at the end of the comment :)