I have a NSString representing sha1 hash of some data and I need to convert it to binary string, but cant find any good solution to do that. It should be equivalent to PHP’s pack function.
The result should be like this: 0xb7, 0xc7, 0x91, …, 0x90.
I than need to convert this binary to base64-encoded string.
You can easily to do so with a
NSString+Base64catalog.And the code should like this:
Here is the Code of NSString+Base64.h file for example:
And the NSString+Base64.m file: