Link: http://www.z-f.fr/forum/viewtopic.php?pid=27581
With thanks to the link above, this code snippet delivers the encrypted value of the password from the database.
PHP:
$manager=Doctrine_Manager::getInstance(); | |
$conn=Doctrine_Manager::connection('mysql://user:password@localhost/database','doctrine'); | |
$aPasswords=array('password','banana','toast'); | |
foreach ($aPasswords as $password) | |
{ | |
$salt=mt_rand(); | |
$encrypt = new Doctrine_Expression("AES_ENCRYPT('".htmlspecialchars($password,ENT_QUOTES)."','".$salt."')"); | |
$encrypted_password=$conn->fetchOne('SELECT '.$encrypt,array()); | |
echo 'Password: '.$password.' Salt: '.$salt.' Encrypted Password: '.$encrypted_password.PHP_EOL; | |
} | |
exit; |