MySQL MD5 SELECT

会有一股神秘感。 提交于 2019-12-04 22:57:41
SELECT md5(CONCAT('Vwm', md5(CONCAT('123123', 'Vwm' )), '123123' )) ;

You need to concat() the strings then execute md5() on them.

This way it returns correctly the same value as your PHP script:

+--------------------------------------------------------------+
| md5(CONCAT('Vwm', md5(CONCAT('123123', 'Vwm' )), '123123' )) |
+--------------------------------------------------------------+
| 422ad0c19a38ea88f4db5e1fecaaa920                             |
+--------------------------------------------------------------+
Marc B

String concatenation in MySQL requires using CONCAT()`. This;

md5( '123123' + 'Vwm' )

is actually adding a number to a string:

mysql> select '12123' + 'Vwm';
+-----------------+
| '12123' + 'Vwm' |
+-----------------+
|           12123 |
+-----------------+

So your query is not the same as the PHP side, as you're not hashing the same string.

  • salt should be in your script
  • salted password in your database
  • your script is salting password and compare with salted version in db
  • if same consider OK
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!