0

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.

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

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

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

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.

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

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

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

Community
  • 1
  • 1
  • the thing you have get in swift program may be a NSData(I am not quite sure), try to convert it to string and print it again. let convertString = NSString(data: yourData, encoding: NSUTF8StringEncoding) – Surely Dec 12 '15 at 16:08
  • 1
    You have to decode the percent escapes "%3D%3D" to "==". – Martin R Dec 12 '15 at 16:33

1 Answers1

0

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