Created
May 24, 2013 22:17
-
-
Save johnclayton/5646870 to your computer and use it in GitHub Desktop.
This file contains 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
- (NSString *) MD5Hash { | |
const char *cStr = [self UTF8String]; | |
unsigned char result[CC_MD5_DIGEST_LENGTH]; | |
CC_MD5( cStr, (CC_LONG)strlen(cStr), result ); | |
NSMutableString *hash = [[NSMutableString alloc] initWithCapacity:CC_MD5_DIGEST_LENGTH * 2]; | |
for (int i = 0; i < 16; i++) { | |
[hash appendFormat: @"%02x", result[i]]; | |
} | |
return hash; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment