# 2x speedup for hash_pbkdf2

- Thread: https://externals.io/message/87017
- Original archive: https://news-web.php.net/php.internals/87017
- Started by Joseph Birr-Pixton on 2015-07-04T20:57:30+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #87017 — Joseph Birr-Pixton — 2015-07-04T20:57:30+00:00

URL: https://externals.io/message/87017#87017

Hi folks,

I've just filed PR #1387:

https://github.com/php/php-src/pull/1387

This moves invariant parts of the HMAC calculation out of the inner
PBKDF2 loop. That means half the compression function applications are
needed; performance is ~doubled as a result.

A non-scientific comparison for doing 2**23 iterations with SHA1:

- Python 3.4: 7.67s
- OpenSSL 1.0.1f: 7.95s
- PHP 5.6.10: 12.74s
- PHP 5.6.10 (with this change): 6.71s

Thanks,
Joe
