• 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: Obscuring an NSString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Obscuring an NSString


  • Subject: Re: Obscuring an NSString
  • From: Fritz Anderson <email@hidden>
  • Date: Thu, 2 Dec 2010 08:19:19 -0600

On 2 Dec 2010, at 7:30 AM, Adam Gerson wrote:

> I am writing an NSString to a file and I would like to obscure it in a
> two way reversible fashion. It doesn't have to be major hacker proof,
> just not understandable by an average person. I need to be able to
> read the value back in from the file and convert it back to "clear
> text". In php I would just use base64 encode / decode. All the cocoa
> examples I have found show converting in base64 between nsstring and
> nsdata. Is there a smiple function I can pass an NSString through to
> obscure it while keeping it as a string, then reverse it back to clear
> text in a reliable way?

Base64 works only bytewise, whereas NSString is notionally UTF-16, so the base64 result really is byte data (representable as NSData), and not a string.

If the only purpose of the base64 data is to be the contents of a file, I don't see your objection to its being NSData at the last step before writing and the first step after reading. You already have methods to get an NSString whenever you want it. Why is that not enough? You seem to have a requirement you're not telling us about.


	— F

_______________________________________________

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: 
 >Obscuring an NSString (From: Adam Gerson <email@hidden>)

  • Prev by Date: navigation bar tint color issue on iOS 4.2
  • Next by Date: Re: Cocoa-dev Digest, Vol 7, Issue 1076
  • Previous by thread: Re: Obscuring an NSString
  • Next by thread: WebView w/ Java Plugin in NSTabView
  • Index(es):
    • Date
    • Thread