I don't know how to md5 my password in iPhone ,or how to start. I tried to know something like CommonCrypto.Will help? urgely for a suggestion~ thanks~
Asked
Active
Viewed 367 times
1 Answers
0
This answer / question on the Apple Forums actually has several valid implementations of an md5 hash on the iPhone: https://discussions.apple.com/message/7362074?messageID=7362074#7362074?messageID=7362074.

elliottbolzan
- 1,057
- 1
- 15
- 30
-
it works. thanks~ https://discussions.apple.com/message/7362074?messageID=7362074#7362074?messageID=7362074 // Function definition NSString * md5( NSString *str ) { const char *cStr = [str UTF8String]; unsigned char result[CCMD5_DIGESTLENGTH]; CC_MD5( cStr, strlen(cStr), result ); return [NSString stringWithFormat: @"%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", result[0], result[1], result[2], result[3], result[4], result[5], result[6], result[7], result[8], result[9], result[10], result[11], result[12], result[13], result[14], result[15] ]; } – anna Apr 12 '12 at 13:35
-
If it works, please accept the answer, to show others that the issue has been resolved :) – elliottbolzan Apr 12 '12 at 13:42
-
here again~ I wonder where CommonCrypto belongs~cause"One of my iPhone apps uses the
framework for calculating hashes. There is plenty of documentation in the XCode doc sets on the subject. Do a full text search in All Doc Sets for 'CommonDigest'. You will find the CC_MD5 man pages. (For new applications it is preferred to use SHA-256.) In the iPhone Simulator it all works fine. I can not test it on the iPhone itself" Does this mean CommonCrypto doesn't belong to iOS SDK but MAC OS SDK? – anna Apr 12 '12 at 13:54 -
It's a Mac command~sigh~~Mac OS X Manual Page For CC_MD5_Final(3cc) https://developer.apple.com/library/ios/#documentation/System/Conceptual/ManPages_iPhoneOS/man3/CC_MD5_Final.3cc.html – anna Apr 12 '12 at 14:03
-
They seem to get it to work on iOS here: http://stackoverflow.com/questions/6480883/how-to-use-common-crypto. – elliottbolzan Apr 12 '12 at 14:04