Expand description
The password hash algorithms of utopia-php/auth (Utopia\Auth\Hashes) that PHP
itself does not provide: the scrypt KDF of the PECL scrypt extension, Firebase’s
modified scrypt, and phpass’s portable hashes. The rest (password_hash(),
password_verify(), crypt(), hash()) are PHP’s own functions, ported in php-std.
Every function here returns what PHP returns for the same input, byte for byte, including
where PHP fails: scrypt::scrypt fails as scrypt() does, with its Errors, its
warnings and its false.
Modules§
- firebase
- Firebase’s modified scrypt, as
Utopia\Auth\Hashes\ScryptModifiedcomputes it: scrypt (N = 16384, r = 8, p = 1, 64 bytes) of the password under the salt and its separator, and the signer key encrypted with AES-256-CTR under the first 32 bytes of that, from a zero IV. - phpass
- The pieces of phpass (Openwall’s Portable PHP password hashing framework 0.5) that
Utopia\Auth\Hashes\PHPassimplements in PHP: its base64 variant, its blowfish salt and the MD5 rounds of its portable ($P$, phpBB’s$H$) hashes. - scrypt
scrypt()of the PECLscryptextension 2.0.1, whichUtopia\Auth\Hashes\ScryptandScryptModifiedcall: the scrypt KDF of RFC 7914 (Colin Percival’scrypto_scrypt), with the extension’s checks, in its order and with its messages.
Functions§
- hash_
equals - PHP
hash_equals($known, $user): false at once when the lengths differ (PHP leaks the length too), otherwise a comparison whose time does not depend on where they differ. - password_
salt php_password_make_salt($length), the saltpassword_hash()draws:$length * 3 / 4 + 1random bytes in base64,+as., cut to$lengthcharacters (22 for bcrypt, 16 for Argon2, which hashes these characters as its salt).- random_
bytes - PHP
random_bytes($length): bytes from the operating system’s CSPRNG.