php-src/ext/standard/tests/crypt/bcrypt_invalid_algorithm.phpt
Anthony Ferrara 462fef794f Add deprecated notice to invalid DES salts.
This will cause an error in the case where invalid salts are provided for other algorithms. Currently, these invalid salts will silently fall back to STD_DES which is extremely weak. By detecting invalid DES salts, we can alert the user that there is a bug in their code.

The error is currently E_DEPRECATED as this has potential to break currently working (yet insecure) code. In the future it should be changed to an E_WARNING and return *0
2015-01-09 11:18:33 -05:00

12 lines
302 B
PHP

--TEST--
Test BCRYPT with invalid algorithm
--FILE--
<?php
var_dump(crypt("test", "$23$04$1234567890123456789012345"));
var_dump(crypt("test", "$20$04$1234567890123456789012345"));
var_dump(crypt("test", "$2g$04$1234567890123456789012345"));
?>
--EXPECTF--
string(2) "*0"
string(2) "*0"
string(2) "*0"