MySQL MD5选择 [英] MySQL MD5 SELECT
本文介绍了MySQL MD5选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下查询返回空值.
SELECT `email`, `password`, `salt` FROM `users` WHERE `password` = md5(`salt`+md5('123123'+`salt`)+'123123') AND `email` = 'xeka@xeka.ru'
以下查询返回了"d2b4312db21705dafd96df14f8525fef",但为什么呢?
The following query returned 'd2b4312db21705dafd96df14f8525fef', but why?
SELECT md5( 'Vwm' + md5( '123123' + 'Vwm' ) + '123123' )
此代码返回了'422ad0c19a38ea88f4db5e1fecaaa920'.
This code returned '422ad0c19a38ea88f4db5e1fecaaa920'.
$salt = 'Vwm';
$password = '123123';
echo md5($salt . md5($password . $salt) . $password);
执行用户授权.如何创建对数据库的查询,以便第一个使用SALT和SALT的对象执行MD5功能?
Do user authorization. How do I create a query to the database so that the first took SALT and SALT have this I did some MD5 function?
推荐答案
SELECT md5(CONCAT('Vwm', md5(CONCAT('123123', 'Vwm' )), '123123' )) ;
您需要concat()字符串,然后对它们执行md5().
You need to concat() the strings then execute md5() on them.
这样,它可以正确返回与您的PHP脚本相同的值:
This way it returns correctly the same value as your PHP script:
+--------------------------------------------------------------+
| md5(CONCAT('Vwm', md5(CONCAT('123123', 'Vwm' )), '123123' )) |
+--------------------------------------------------------------+
| 422ad0c19a38ea88f4db5e1fecaaa920 |
+--------------------------------------------------------------+
这篇关于MySQL MD5选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文