+ (NSData *)hexToBytes:(NSString *)str {
NSMutableData *data = [NSMutableData data];
int idx;
for (idx = 0; idx+2 <= str.length; idx+=2) {
NSRange range = NSMakeRange(idx, 2);
NSString* hexStr = [str substringWithRange:range];
NSScanner* scanner = [NSScanner scannerWithString:hexStr];
unsigned int intValue;
[scanner scanHexInt:&intValue];
[data appendBytes:&intValue length:1];
}
return data;
// 8afb0a3df680e1e1c0c3407e47f6c548 NSString
// <8afb0a3d f680e1e1 c0c3407e 47f6c548> NSData
}