Re: NSMapTable with C strings as keys
Re: NSMapTable with C strings as keys
- Subject: Re: NSMapTable with C strings as keys
- From: Jens Alfke <email@hidden>
- Date: Tue, 28 May 2013 15:51:33 -0700
On May 28, 2013, at 3:39 PM, Michael Hall <email@hidden> wrote:
> https://news.ycombinator.com/item?id=4036878
> SHA-1is still used in applications such as git as a general purpose hash function.
> Not this particular article where I saw it but I recently signed up on git and think I may of seen it's use then.
Not exactly. It’s used in many version control systems as a highly reliable checksum to produce unique IDs for revisions, particularly IDs that can’t be forged. That’s not the same as a hash function, because in an application like this, a hash collision would cause serious problems like data loss. (That’s why you use something with 160 bits of output not 32!)
I’m sure these Git revision IDs do get used as hash keys at some point in some algorithms, but that’s not really their purpose (if you already have a SHA digest it’s cheaper to use it directly as a hash code than running its 160 bits through an in-memory hash algorithm, but it’s not necessary.)
—Jens
_______________________________________________
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