Re: NSString -initWithData:encoding returning nil
Re: NSString -initWithData:encoding returning nil
- Subject: Re: NSString -initWithData:encoding returning nil
- From: Kyle Sluder <email@hidden>
- Date: Fri, 4 Sep 2009 14:33:03 -0700
On Fri, Sep 4, 2009 at 2:28 PM, Alex Reynolds<email@hidden> wrote:
> Why would the call to -initWithData:encoding (the "encryptedString"
> variable) fail?
Question: What are the chances of SHA1 output being a valid UTF-8 string?
Answer: Very close to 0.
You can't take pseudorandom data (which is the whole point of message
digests) and expect to make a string out of it.
What are you trying to do? Make a string representation (like 0xabcd
=> @"ABCD")?
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden