Req #76013 [NEW]: Add simple hashes support in password_verify
| From: | anrdaemon at freemail dot ru | Date: | Mon, 26 Feb 2018 17:45:42 +0000 |
| Subject: | Req #76013 [NEW]: Add simple hashes support in password_verify | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-214115@lists.php.net to get a copy of this message | ||
From: anrdaemon at freemail dot ru
Operating system:
PHP version: Irrelevant
Package: hash related
Bug Type: Feature/Change Request
Bug description:Add simple hashes support in password_verify
Description:
------------
If only password_verify could support regular md5/sha1 hashes, it would
make hell of a jumpstart for old applications migrating to new hashing
schemes.
Test script:
---------------
<?php
$pass = 'MyCoolPass';
$md5 = md5($pass);
$sha1 = sha1($pass);
$crypt = crypt($pass);
$crypts = crypt($pass, (string)rand());
$hash = password_hash($pass, PASSWORD_DEFAULT);
var_dump(
password_get_info($md5), password_get_info($sha1),
password_get_info($crypt), password_get_info($crypts),
password_get_info($hash),
password_verify($pass, $md5), password_needs_rehash($md5,
PASSWORD_DEFAULT),
password_verify($pass, $sha1), password_needs_rehash($sha1,
PASSWORD_DEFAULT),
password_verify($pass, $crypt), password_needs_rehash($crypt,
PASSWORD_DEFAULT),
password_verify($pass, $crypts), password_needs_rehash($crypts,
PASSWORD_DEFAULT),
password_verify($pass, $hash), password_needs_rehash($hash,
PASSWORD_DEFAULT)
);
Expected result:
----------------
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(false)
Actual result:
--------------
bool(false)
bool(true)
bool(false)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(false)
--
Edit bug report at https://bugs.php.net/bug.php?id=76013&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76013&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76013&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76013&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=76013&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=76013&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=76013&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=76013&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=76013&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=76013&r=support
Expected behavior: https://bugs.php.net/fix.php?id=76013&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=76013&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=76013&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=76013&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76013&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=76013&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=76013&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=76013&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=76013&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=76013&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=76013&r=mysqlcfg