Created
June 13, 2015 06:50
-
-
Save jebai0521/f47fedb3dd184f25f56a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <CommonCrypto/CommonDigest.h> | |
- (NSString *)md5HexDigest:(NSString*)password | |
{ | |
const char *original_str = [password UTF8String]; | |
unsigned char result[CC_MD5_DIGEST_LENGTH]; | |
CC_MD5(original_str, strlen(original_str), result); | |
NSMutableString *hash = [NSMutableString string]; | |
for (int i = 0; i < 16; i++) | |
{ | |
[hash appendFormat:@"%02X", result[i]]; | |
} | |
NSString *mdfiveString = [hash lowercaseString]; | |
NSLog(@"Encryption Result = %@",mdfiveString); | |
return mdfiveString; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment