Hi Mirco, On 19/11/2026 18:40, Mirco Babin wrote:
When a password can consist of bytes, it is no longer a password intended for human entry; instead, it functions more like an API key.
Whether you call it a "password" or a "secret" or whatever else, storing such values hashed seems reasonably useful. You could maybe argue that the "password_" prefix on the functions implies "human entry", and that the wrapper functions should *always* validate their input in some way; that could be a separate proposal if you think it's justified, but it doesn't seem related to a single hashing algorithm.
When the Bcrypt-2a revision was introduced, UTF-8 was apparently also made mandatory. However, I cannot find a primary source for this claim. A secondary source is: https://javadoc.io/doc/at.favre.lib/bcrypt/latest/at/favre/lib/crypto/bcrypt/BCrypt.Version.html#VERSION_2A
I've seen this in a few other places as well, but also haven't been able to find a primary source, and I'm not really clear what such a requirement means. In a language like Ruby where strings are tagged with an encoding, it might make sense to transparently normalise input to UTF-8. In a language like PHP where strings are untagged byte sequences, the most you can do is reject strings which are *impossible* in UTF-8, but can't prove that the string was *intended* as UTF-8.
Notably, "required to be UTF-8" does not place any restriction on which code points can be included in the string; so control characters including null bytes would still be accepted without some additional requirement.
PHP can have Argon2 support via one of three external libraries: libargon2, libsodium, or openssl. Making it available in all builds means including a copy of one of those libraries directly in the source tree. So the decision can be made to make PASSWORD_ARGON2ID available everywhere.
Yes, there is no law of physics which prevents it being made available in all builds. But there is a significant downside which means it is unlikely to happen in practice.
The bcrypt-plain is giving 72*8 significant inputbits to Bcrypt. The bcrypt-wrap-prehashed-password is giving 54*8 significant inputbits to Bcrypt. That is a deterioration of 18*8 bits, or 25%.
Is there a security property of the bcrypt algorithm that depends on this "significant inputbits" figure?
Certainly, it does not affect the number of possible *outputs*, because the output size is fixed at 23 bytes. If the algorithm is perfectly uniform, no two 23-byte inputs will produce the same output; but it is guaranteed by the Pigeonhole Principle that multiple inputs at any length larger than that will produce the same output.
In other words, both algorithms will reduce 2^576 possible 72-byte inputs to 2^184 possible 23-byte outputs; whether that reduction happens in one step, two, or more doesn't seem to have any mathematical significance.
Regards, -- Rowan Tommins [IMSoP]
