• 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: NSMapTable with C strings as keys
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >NSMapTable with C strings as keys (From: Oleg Krupnov <email@hidden>)
 >Re: NSMapTable with C strings as keys (From: Jens Alfke <email@hidden>)
 >Re: NSMapTable with C strings as keys (From: Oleg Krupnov <email@hidden>)
 >Re: NSMapTable with C strings as keys (From: Michael Crawford <email@hidden>)
 >Re: NSMapTable with C strings as keys (From: Jens Alfke <email@hidden>)
 >Re: NSMapTable with C strings as keys (From: Michael Hall <email@hidden>)
 >Re: NSMapTable with C strings as keys (From: Michael Hall <email@hidden>)

  • Prev by Date: Re: NSMapTable with C strings as keys
  • Next by Date: Re: NSMapTable with C strings as keys
  • Previous by thread: Re: NSMapTable with C strings as keys
  • Next by thread: Re: NSMapTable with C strings as keys
  • Index(es):
    • Date
    • Thread