ord, md5 shows different behaviour on @

人走茶凉 提交于 2021-02-07 10:58:50

问题


I used ord to check @ and @‪ are same char. But ord output the same value while md5 does not.

php -a
Interactive shell

php > echo ord('@');
64
php > echo ord('@‪');
64

php > echo md5('@');
518ed29525738cebdac49c49e60ea9d3
php > echo md5('@‪');
e6124653b6620abe51d7c401a7644674
php >

Here is the screenshot,


回答1:


Your second one is @ followed by U+202A - LEFT-TO-RIGHT EMBEDDING. As they are different strings, naturally they have different MD5 encodings.

php > echo md5("@\u{202a}");
e6124653b6620abe51d7c401a7644674


来源:https://stackoverflow.com/questions/58010681/ord-md5-shows-different-behaviour-on

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!