tags:

views:

99

answers:

1

what would be a good way to hash the ISBN of a book? sorry for the confusion let me clarify, I want to hash the ISBN of books of size 1000. but the array might grow. its a hash table not encryption. the programming language is c but this is a general question. I want to know the standard hashing method for ISBN used in the industry or your suggestions.

+2  A: 

I doubt there's an industry standard hash function for ISBNs. The industry standards have to do with the 978 prefix and other prefixes, and with how ISBNs get allocated to different publishers. In my own ISBN-based application, I use a bog-standard hash function intended for use with strings. I take no advantage of the fact that the ISBN is limited to decimal digits (or in the case of the check digit, decimal or X), and I go ahead and hash the check digit even though it's redundant. It's so fast to hash a 10- or 13-digit string that doing special-case stuff might actually slow things down.

Popular hash functions for C programmers include the Jenkins hash functions; also Hsieh, Torek, SuperFastHash, and murmurhash. I'm sure there are others; you can search for them. Also you'll find a collection at http://www.cse.yorku.ca/~oz/hash.html.

Norman Ramsey
+1 for pointing out that on such trivial data sizes the specific algorithm rarely matters.
JUST MY correct OPINION
thank you very much
user1