When calling hash on the built in NSData class in the foundation framework — what implementation is used to return the hash value? (CRC32, something else?)
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Something else. Actually it’s an implementation detail, which does not need to use a fixed algorithm in different versions.
You can check the implementation in the open source version of Core Foundation. Note that NSData is toll-free bridged to CFDataRef. From http://opensource.apple.com/source/CF/CF-635.21/CFData.c:
we see that the first 80 bytes are used to compute the hash. The function CFHashBytes is implemented as using the ELF hash algorithm: