Eliminate NSData and NSArray additions categories. Kill date formatter wrapper class

This commit is contained in:
Blake Watters
2012-09-04 21:43:37 -04:00
parent 658e392468
commit b1a2677937
8 changed files with 2 additions and 251 deletions

View File

@@ -1,33 +0,0 @@
//
// NSData+RKAdditions.h
// RestKit
//
// Created by Jeff Arena on 4/4/11.
// Copyright (c) 2009-2012 RestKit. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
/**
Provides extensions to NSData for various common tasks.
*/
@interface NSData (RKAdditions)
/**
Returns a string of the MD5 sum of the receiver.
@return A new string containing the MD5 sum of the receiver.
*/
- (NSString *)MD5;
@end

View File

@@ -1,46 +0,0 @@
//
// NSData+MD5.m
// RestKit
//
// Created by Jeff Arena on 4/4/11.
// Copyright (c) 2009-2012 RestKit. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#import <CommonCrypto/CommonDigest.h>
#import "NSData+RKAdditions.h"
#import "RKMacros.h"
RK_FIX_CATEGORY_BUG(NSData_RKAdditions)
@implementation NSData (RKAdditions)
- (NSString *)MD5
{
// Create byte array of unsigned chars
unsigned char md5Buffer[CC_MD5_DIGEST_LENGTH];
// Create 16 byte MD5 hash value, store in buffer
CC_MD5(self.bytes, (CC_LONG)self.length, md5Buffer);
// Convert unsigned char buffer to NSString of hex values
NSMutableString *output = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH *2];
for (int i = 0; i < CC_MD5_DIGEST_LENGTH; i++) {
[output appendFormat:@"%02x", md5Buffer[i]];
}
return output;
}
@end