• 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
NSString inaccurate Hash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSString inaccurate Hash


  • Subject: NSString inaccurate Hash
  • From: d2kagw <email@hidden>
  • Date: Mon, 5 Feb 2007 08:13:01 +1100

Hi all,

I'm having an issue with some NSString Hashes...
Consider this Log entry:
NSLog ( @"%u - %u", [[NSString stringWithString:@"/Users/Azza/Music/ Various Artists - Top Hits/track.01.artist.02.03.mp4"] hash], [[NSString stringWithString:@"/Users/Azza/Music/Various Artists - Top Hits/track.02.artist.02.03.mp4"] hash] );


it should log the hash of two strings: "/Users/Azza/Music/Various Artists - Top Hits/track.01.artist.02.03.mp4" and "/Users/Azza/Music/ Various Artists - Top Hits/track.02.artist.02.03.mp4"
the difference between them being "track.01" vs. "track.02"


If I execute this code I get the result "2040446062 - 2040446062" meaning the two hashes are identical!?
I knew NSString hash wasn't exactly unique, but I would have expected a little more than this :P


are there any other good hash methods/classes avaliable that I can use to generate hashes ( my app creates cache files of accessed data and the hash was meant to be the unique filename for the cache )

cheers!!!
- Az
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


  • Follow-Ups:
    • Re: NSString inaccurate Hash
      • From: Ali Ozer <email@hidden>
    • Re: NSString inaccurate Hash
      • From: Chris Suter <email@hidden>
  • Prev by Date: Re: Binding to a specific element in an array
  • Next by Date: Re: NSString inaccurate Hash
  • Previous by thread: RegisterProcess failed (error = -50)
  • Next by thread: Re: NSString inaccurate Hash
  • Index(es):
    • Date
    • Thread