Skip to content

Double speed of PBKDF2 #9605

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

Closed
wants to merge 1 commit into from
Closed

Double speed of PBKDF2 #9605

wants to merge 1 commit into from

Conversation

plstand
Copy link
Contributor

@plstand plstand commented Sep 23, 2022

This is an updated version of #1387 for PHP-8.0. Fixes #9604.

Below is the commit message from the original author:


By hoisting the processing of inner/outer key blocks out of the inner loop, we calculate PBKDF2 with approx half the hash compression function applications.

Speed comparison:

test.php is:

$ TIME='%U' time php test.php
24.56

$ TIME='%U' time ./sapi/cli/php test.php
12.82

By hoisting the processing of inner/outer key blocks
out of the inner loop, we calculate PBKDF2 with approx
half the hash compression function applications.

Speed comparison:

test.php is:

<?php hash_pbkdf2('sha1', 'password', 'saltsalt', 1 << 24, 0); ?>

$ TIME='%U' time php test.php
24.56

$ TIME='%U' time ./sapi/cli/php test.php
12.82
@devnexen
Copy link
Member

Nice and consistent performance improvements overall from @ctz

@devnexen
Copy link
Member

I see no harm merging it personally however it seems to still perform less well than its openssl counterpart, and also pbkdf2, overall, is less appealing nowadays but that is just my take.

@Girgias
Copy link
Member

Girgias commented Jan 25, 2023

This should be rebased onto master.

@github-actions
Copy link

There has not been any recent activity in this PR. It will automatically be closed in 7 days if no further action is taken.

@github-actions github-actions bot added the Stale label Mar 27, 2023
@devnexen
Copy link
Member

@plstand do you still want to work on it ?

@github-actions github-actions bot removed the Stale label Mar 28, 2023
@github-actions
Copy link

There has not been any recent activity in this PR. It will automatically be closed in 7 days if no further action is taken.

@github-actions github-actions bot added the Stale label May 28, 2023
@github-actions github-actions bot closed this Jun 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants