I am attempting to convert an HMAC (hashed data) to a string safe for urls for authentication purposes.
Im having problems converting data generated from sha256 hashing (using apples crypto library) to Unicode in both little and big Endian, one hashed string will work in big and not in little, and visa versa for a different hashed string. For some hashed strings it works perfectly. I think it may have something to do with an out of range character or something. When I say it doesn't work, I mean it returns nil.
The code looks like this:
NSString *mystring = [[NSString alloc] initWithData:myHash encoding:NSUnicodeEncoding
Is Unicode the best to use? I tried encoding to UTF8, it returns nil and ascii doesn't have all the characters, I get a few "?" where data is missing.
Really, my question is, how do I make A string from NSData from a sha256 hash?
Solution:
https://github.com/eczarny/xmlrpc
NSData+Base64.h and NSData+Base64.m