Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: ios5
Fetching contributors…

Cannot retrieve contributors at this time

executable file 24 lines (20 sloc) 0.578 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
//
// NSData+SSToolkitAdditions.m
// SSToolkit
//
// Created by Sam Soffes on 9/29/08.
// Copyright 2008-2011 Sam Soffes. All rights reserved.
//

#import "NSData+SSToolkitAdditions.h"
#include <CommonCrypto/CommonDigest.h>

@implementation NSData (SSToolkitAdditions)

- (NSString *)MD5Sum {
unsigned char digest[CC_MD5_DIGEST_LENGTH], i;
CC_MD5([self bytes], [self length], digest);
NSMutableString *ms = [NSMutableString string];
for (i = 0; i < CC_MD5_DIGEST_LENGTH; i++) {
[ms appendFormat: @"%02x", (int)(digest[i])];
}
return [[ms copy] autorelease];
}

@end
Something went wrong with that request. Please try again.