• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSString -initWithData:encoding returning nil
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >NSString -initWithData:encoding returning nil (From: Alex Reynolds <email@hidden>)

  • Prev by Date: NSString -initWithData:encoding returning nil
  • Next by Date: Re: NSString -initWithData:encoding returning nil
  • Previous by thread: NSString -initWithData:encoding returning nil
  • Next by thread: Re: NSString -initWithData:encoding returning nil
  • Index(es):
    • Date
    • Thread