2

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?

1 Answer 1

3

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. :)

Sign up to request clarification or add additional context in comments.

1 Comment

i have it in a single function returning hex values in a string, but thanks anyway

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.