I have this code in my code (md5 hashing)
unsigned char result[16];
// fill result with data
[NSString stringWithFormat:
@"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%开发者_如何转开发02x%02x",
result[0], result[1], result[2], result[3],
result[4], result[5], result[6], result[7],
result[8], result[9], result[10], result[11],
result[12], result[13], result[14], result[15]
];
Is there some faster way, how to push whole array in NSString than this code?
That's the fastest way to hexify 16 characters into an NSString
. If you do this often, wrap it up in a function so you only have one copy of the code. :)
精彩评论