Today's Menu  Portugal
journal and plan nutrition
Instance Methods | List of all members
NSData(MD5) Category Reference

#import <NSData+MD5.h>

Instance Methods

(NSString *) - MD5
 

Detailed Description

Definition at line 11 of file NSData+MD5.h.

Method Documentation

◆ MD5()

- (NSString *) MD5

Definition at line 14 of file NSData+MD5.m.

15 {
16  // Create byte array of unsigned chars
17  unsigned char md5Buffer[CC_MD5_DIGEST_LENGTH];
18 
19  // Create 16 byte MD5 hash value, store in buffer
20  CC_MD5(self.bytes, (unsigned int)self.length, md5Buffer);
21 
22  // Convert unsigned char buffer to NSString of hex values
23  NSMutableString *output = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2];
24  for(int i = 0; i < CC_MD5_DIGEST_LENGTH; i++)
25  [output appendFormat:@"%02x",md5Buffer[i]];
26 
27  return output;
28 }

The documentation for this category was generated from the following files: