Re: Need localization-proof method of transporting dates.
Re: Need localization-proof method of transporting dates.
- Subject: Re: Need localization-proof method of transporting dates.
- From: Michael Ash <email@hidden>
- Date: Mon, 6 Apr 2009 01:04:26 -0400
On Sun, Apr 5, 2009 at 9:18 PM, Greg Guerin <email@hidden> wrote:
> As a design, it might be more flexible to define a -gc_canonicalData method
> that returns an NSData containing unhashed canonical bytes, rather than
> -gc_sha1hash that returns a hash. This would make it easier to use
> different secure-hash algorithms, should that be desired. SHA1 isn't
> exactly state-of-the-art.
Good point. Although this has the disadvantage of temporarily using a
bunch of memory, roughly doubling your footprint for this data
structure, that's not likely to be a problem for the typical use cases
for this thing.
> I'd also make the code that calculates the hash from a given NSDictionary or
> NSArray return an error (or throw an exception) if anything in the
> collection doesn't respond to -gc_canonicalData. Or it could silently skip
> those (not hash them), depending on the context.
Note that it will already throw an exception if something doesn't
respond to the method, simply because this is the default behavior in
NSObject if you send a message to an object that doesn't understand
it. More gentle or controlled failure modes may well be desirable, of
course.
Mike
_______________________________________________
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