Re: Fast hash of NSData?
Re: Fast hash of NSData?
- Subject: Re: Fast hash of NSData?
- From: Kyle Sluder <email@hidden>
- Date: Fri, 29 Nov 2013 15:49:52 -0800
> On Nov 29, 2013, at 2:19 PM, Graham Cox <email@hidden> wrote:
>
>
>> On 29 Nov 2013, at 10:49 pm, Kyle Sluder <email@hidden> wrote:
>>
>> In this scheme, if there is a hash collision, you lose user data. That should be a non-starter. You *must* do a full bytewise comparison in case of collision.
>
> I wouldn’t say a non-starter. In practice, the odds of this are exceedingly small *provided* the hash function is good.
Much as a civil engineer would find it unconscionable to knowingly choose a bridge design that could not be guaranteed to support the design load, so too should a software engineer instinctively avoid any solution that they know has even a remote possibility of losing data under normal operation.
Plus, since you're already keying by size, you can afford to use a faster but higher-collision hashing algorithm.
--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