Swift中相同字符串的不同md5哈希值

时间:2022-10-28 17:01:43

I'm currently working on a swift application based on a particular API of a website. I use the md5 function to create valid url and access some JSON data which I can bring in my application with SwiftJSON.

我目前正在开发基于网站特定API的快速应用程序。我使用md5函数创建有效的URL并访问一些JSON数据,我可以使用SwiftJSON将其带入我的应用程序。

I worked fine for the 6 first url but then I got an error in the checksum of my url. I checked it out and realize my md5 function in swift got the wrong hash

我为6个第一个网址工作得很好,但后来我的网址校验和出错了。我检查了一下,发现我在swift中的md5函数得到了错误的哈希

In my swift program, the hash of the string "answerfr1%3D%3DQf7AjOptTN6k2OyoTa7QjOptDM6k2OzoTa7cjOptjM6k2O1oTa7EjOptDMxoTa7AjOptnO2oTY" Give me this "09938c1325c87ef89251f668a8cf5d42" But it's not correct because my link isn't valid

在我的swift程序中,字符串“answerfr1%3D%3DQf7AjOptTN6k2OyoTa7QjOptDM6k2OzoTa7cjOptjM6k2O1oTa7EjOptDMxoTa7AjOptnO2oTY”的哈希给我这个“09938c1325c87ef89251f668a8cf5d42”但它不正确,因为我的链接无效

But by doing it myself with http://www.md5.cz/ I have this for result "9d78b73d28f590beb8ef25b5e4b99a1d" and my link works perfectly.

但是我自己用http://www.md5.cz/做了这个结果“9d78b73d28f590beb8ef25b5e4b99a1d”,我的链接完美无缺。

I don't know why my md5 function have no issues with the 6 first hash but give me a wrong hash for the 7.

我不知道为什么我的md5函数对6个第一个哈希没有问题,但给了我一个错误的哈希值。

And I realize www.md5.fr give me the same wrong code. Why is there different md5 hash for the same strings ?

我意识到www.md5.fr给了我同样错误的代码。为什么同一个字符串有不同的md5哈希?

My md5 function in swift : How to convert string to MD5 hash using ios swift

我在swift中的md5函数:如何使用ios swift将字符串转换为MD5哈希

Hope you guys understand my issues here! Sorry for my bad english

希望你们在这里了解我的问题!对不起,我的英语不好

1 个解决方案

#1


0  

Thanks Martin R, you solved my problem "%3D" is equal to "=" so "%3D%3D" is equal to "=="

谢谢Martin R,你解决了我的问题“%3D”等于“=”所以“%3D%3D”等于“==”

#1


0  

Thanks Martin R, you solved my problem "%3D" is equal to "=" so "%3D%3D" is equal to "=="

谢谢Martin R,你解决了我的问题“%3D”等于“=”所以“%3D%3D”等于“==”