1 #import "ITCategory-NSString.h"
2 #import "ITCategory-NSData.h"
4 @implementation NSString (ITFoundationCategory)
6 + (id)stringWithFourCharCode:(unsigned long)fourCharCode {
7 return [[[self alloc] initWithFourCharCode:fourCharCode] autorelease];
10 - (id)initWithFourCharCode:(unsigned long)fourCharCode {
11 return [self initWithString:(NSString *)UTCreateStringForOSType(fourCharCode)];
12 //return [self initWithFormat:@"%.4s", &fourCharCode];
15 - (unsigned long)fourCharCode {
16 return UTGetOSTypeFromString((CFStringRef)self);
18 //Die nasty bitshifting
19 /*const unsigned char *c_s = [self UTF8String];
20 unsigned long tmp = *c_s++;
26 return tmp |= *c_s++;*/
30 return [[self dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:NO] MD5];
34 return [[self dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:NO] SHA1];