Skip to content

ext/standard: bcrypt-sha256 password hash - #24073

Open
Sjord wants to merge 9 commits into
php:masterfrom
Sjord:bcrypt_sha256
Open

Sjord wants to merge 9 commits into
php:masterfrom
Sjord:bcrypt_sha256

Conversation

@Sjord

@Sjord Sjord commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

During the discussion on the 72-byte limit of bcrypt, Tim suggested implementing passlib's bcrypt-sha256. That does a HMAC of the password before passing it to bcrypt, solving the 72-byte limit and also the null-byte problem.

This implements bcrypt-sha256 as an algorithm to pass to password_hash / _verify.

Comment thread ext/standard/php_password.h Outdated
Comment thread ext/standard/password.c Outdated
@Sjord

Sjord commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

Ping @TimWolla @narfbg. I vibe-coded bcrypt sha256 support for password_hash / _verify.

Comment thread ext/standard/tests/password/password_bcrypt_sha256_errors.phpt Outdated
Comment thread ext/standard/tests/password/password_bcrypt_sha256_hash.phpt Outdated
Comment thread ext/standard/tests/password/password_bcrypt_sha256_needs_rehash.phpt Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test should likely be marked as slow.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I see this is not resolved.

Comment thread ext/standard/password.c Outdated
Comment thread ext/standard/password.c Outdated
Comment thread ext/standard/password.c Outdated
Comment thread ext/standard/password.c Outdated
Comment thread ext/standard/password.c Outdated
Comment thread ext/standard/password.c
@Sjord
Sjord marked this pull request as ready for review October 3, 2026 14:38
@Sjord
Sjord requested review from bukka and kocsismate as code owners October 3, 2026 14:38
@Sjord Sjord changed the title bcrypt_sha256 ext/standard: bcrypt-sha256 password hash Oct 3, 2026
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.

2 participants