Posted By

trawor on 08/23/10


Tagged

md5


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

umang_nine
bucko
cnathan


NSString MD5


 / Published in: Objective C
 

  1. - (NSString *) MD5{
  2. const char* string = [self UTF8String];
  3. unsigned char result[16];
  4. CC_MD5(string, strlen(string), result);
  5. NSString* hash = [NSString stringWithFormat:@"%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",
  6. result[0], result[1], result[2], result[3], result[4], result[5], result[6], result[7],
  7. result[8], result[9], result[10], result[11], result[12], result[13], result[14], result[15]];
  8.  
  9. return [hash lowercaseString];
  10. }

Report this snippet  

You need to login to post a comment.