X-Git-Url: http://git.ithinksw.org/ITFoundation.git/blobdiff_plain/6262c31ef1f3b4c4cec3e909f0ecc189eb242ab2..7a5fe3d07552d5513b15989f2c424bc5ae2a68e1:/ITCategory-NSString.m diff --git a/ITCategory-NSString.m b/ITCategory-NSString.m index e08e046..6aed778 100644 --- a/ITCategory-NSString.m +++ b/ITCategory-NSString.m @@ -1,4 +1,5 @@ #import "ITCategory-NSString.h" +#import "ITCategory-NSData.h" @implementation NSString (ITFoundationCategory) @@ -7,7 +8,7 @@ } - (id)initWithFourCharCode:(unsigned long)fourCharCode { - return UTCreateStringForOSType(fourCharCode); + return [self initWithString:(NSString *)UTCreateStringForOSType(fourCharCode)]; //return [self initWithFormat:@"%.4s", &fourCharCode]; } @@ -25,4 +26,12 @@ return tmp |= *c_s++;*/ } +- (NSData *)MD5 { + return [[self dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:NO] MD5]; +} + +- (NSData *)SHA1 { + return [[self dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:NO] SHA1]; +} + @end \ No newline at end of file