1// 2// DataConversion.h 3// FIPSCAVS 4// 5// Created by James Murphy on 04/26/13. 6// Copyright 2013 Apple. All rights reserved. 7// 8// This is confidential and proprietary code of Apple Inc. It may not be 9// used, copied or modified in any way without Apple's expressed 10// written permission in each case. No redistribution of this 11// Apple Confidential code is allowed. 12// 13 14#import <Foundation/Foundation.h> 15 16/*! ========================================================================= 17 @class NSData 18 19 @abstract Extend the NSData object to convert to a hex string 20 ========================================================================= */ 21@interface NSData (DataConversion) 22 23/*! ------------------------------------------------------------------------- 24 @method toHexString 25 26 @result returns a NSString object with the hex characters that 27 represent the value of the NSData object. 28 ------------------------------------------------------------------------- */ 29- (NSString *)toHexString; 30 31@end 32 33 34/*! ========================================================================= 35 @class NSString 36 37 @abstract Extend the NSString object to convert hex string into a 38 binary value in a NSData object. 39 ========================================================================= */ 40@interface NSString (DataConversion) 41 42/*! ------------------------------------------------------------------------- 43 @method hextStringToData 44 45 @result Convert a NSString that contains a set of hex characters 46 into a binary value. If the conversion cannot be done then 47 nil will be returned. 48 ------------------------------------------------------------------------- */ 49- (NSData *)hexStringToData; 50 51@end 52 53 54