Skip to content

Maximum password length should be exposed to userland when libxcrypt is used #17716

Open
@mszabo-wikia

Description

@mszabo-wikia

Description

When PHP is built against an external libxcrypt (--with-external-libcrypt, e.g. on Fedora and derivatives), passwords passed to crypt are limited by CRYPT_MAX_PASSPHRASE_SIZE which is by default 512. However, there's no way for userland to determine whether such a limit is in force, which can cause confusion. For example, the following code:

<?php
var_dump(crypt(str_repeat("a",513),"\$2y\$05\$" . str_repeat("b",22)));

Results in this output:

string(2) "*0"

I think it would be useful to expose this limit as a constant or helper function so that applications can determine whether crypt() password sizes are limited.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions