[RFC] Throw error for passwords longer than 72 bytes in password_hash() with bcrypt

From: Date: Tue, 29 Sep 2026 11:33:05 +0000
Subject: [RFC] Throw error for passwords longer than 72 bytes in password_hash() with bcrypt
Groups: php.internals 
Request: Send a blank email to internals+get-132689@lists.php.net to get a copy of this message
Hello, I have drafted a new RFC: https://wiki.php.net/rfc/bcrypt_max_password_length The proposal is to throw a ValueError when a password longer than 72 characters is passed to password_hash and bcrypt is used. The current behavior is that the password is silently truncated and only the first 72 characters are hashed. The goal is to prevent severe security vulnerabilities that are the result of this silent truncation. This will primarily impact applications that pass something else than just the user's password to password_hash. Please let me know what you think! Regards, Sjoerd

« previous php.internals (#132689) next »