DJB hash function

  • Permalink
  • submit to reddit
  • Email
  • Follow


When I searched for a good hash function for strings, I came across DJB
hash function and found it serving my purpose. I wanted to use that,
but I was unaware of the licensing/copyright issues. I sent a mail to
DJB reg. this, but didn't get any reply.
The info. i got is that DJB posted the hash function first to
Comp.lang.c. Please find below the mail I sent to DJB. Let me know
whether I can use it in my propreitary code.


------------------------------------------------------------------
DJB,

When I was searching for a good hash function for strings, I came to
know about djb2 hash function (written by you a long back) and used by
you in cdb. I tested it and found it has excellent distribution and
speed. I want to use it.

I couldn't find any license info. Please let me know whether I can use
the hash algorithm in proprietary code or any licensing issues
involved.

Thanks for your time.

-------------------------------------------------------------------

Thanks,

0
Reply sureshjayaram1 (10) 5/20/2005 4:31:44 AM

See related articles to this posting


sureshjayaram@gmail.com wrote:
> When I searched for a good hash function for strings, I came across
DJB
> hash function and found it serving my purpose. I wanted to use that,
> but I was unaware of the licensing/copyright issues. I sent a mail to
> DJB reg. this, but didn't get any reply.
> The info. i got is that DJB posted the hash function first to
> Comp.lang.c. Please find below the mail I sent to DJB. Let me know
> whether I can use it in my propreitary code.
<snip>

That's between you and him.  It's offtopic in comp.lang.c.  If you need
to search comp.lang.c archives, use Google Groups.


Mark F. Haigh
mfhaigh@sbcglobal.net

0
Reply mfhaigh (154) 5/20/2005 8:21:08 AM
comp.lang.c 29435 articles. 31 followers. Post

1 Replies
236 Views

Similar Articles

[PageSpeed] 37


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

Function Memoization and Commutative Hash Function
Hi, While trying to improve speed of a function which receives millions of repetitive identical calls I realized that memoization is quite promising for my situation. Furthermore, instead of issuing a (make- hash-table :test #'equal) and using (gethash (cons arg0 arg1) cache), I thought using a hash function for arg0/1 couple would perform better than an EQUAL comparison. And after some more CPU cycles, I realized that I can use a vector instead of the hash-table while I have unique integer hash signatures produced for each input. And suprisingly switching from hash-table to vector, reduc...

Modules for hash functions? (ie, common algorithms for computing hash keys, not manipulating perl hashes)
Are there any modules out there for common string hashing algorithms? I've got a project where I'm going to be setting up a database of texts, potentially large, amongst which we'll need to be able to identify duplicate texts quickly. weston wrote: > Are there any modules out there for common string hashing algorithms? > I've got a project where I'm going to be setting up a database of > texts, potentially large, amongst which we'll need to be able to > identify duplicate texts quickly. perldoc Digest John -- use Perl; program fulfillment ...

User-defined equality/hashing functions in hash tables?
What implementations support user-defined equality/hashing functions for built-in hash tables? Here are the ones I know of: Allegro - :hash-function argument to MAKE-HASH-TABLE CMUCL - DEFINE-HASH-TABLE-TEST function in EXT package SBCL - DEFINE-HASH-TABLE-TEST function in SB-INT package CLISP - DEFINE-HASH-TABLE-TEST macro in EXT package any others? -Peter -- Peter Seibel peter@javamonkey.com Lisp is the red pill. -- John Fraser, comp.lang.lisp Peter Seibel <peter@javamonkey.com> writes: > > any others? LispWork...

Why where hashes called "hash" in hashtables and functions?
Hi I will not loose much sleep if I never get to know why - buf if someone happen to know why one has chosen to call hash-tables/maps "hash" maps and not something else - then it would be interesting to know. What does the word "hash" mean in this context? Terje Flor´┐Ż, Norway In article <2snCb.5730$Y06.92745@news4.e.nsc.no>, Terje Viken <terje.viken@smurfs.org> wrote: >I will not loose much sleep if I never get to know why - buf if someone >happen to know why one has chosen to call hash-tables/maps "hash" maps and ...

Hash Function
HiI want to create word dictionary by hash algorithm. But I don't knowwhat is the best hash function for this and then how to implement hashtable in java.please help methanks On Wed, 04 Jul 2007 20:57:41 -0000, ahd292 <ahd.arman@gmail.com> wrote, quoted or indirectly quoted someone who said : >I want to create word dictionary by hash algorithm. But I don't know >what is the best hash function for this and then how to implement hash >table in java. see http://mindprod.com/jgloss/hashcode.html http://mindprod.com/jgloss/hashtable.html http://mindprod.com/jgloss/hashmap.h...

Hash functions
Do people often use hash() on built-in types? What do you find it useful for? How about on custom classes? Can anyone give me some good tips or hints for writing and using hash functions in Python? Thank you, -- Steven. Steven D'Aprano <steve@REMOVETHIScyber.com.au> writes: > Do people often use hash() on built-in types? Only implicitly. > What do you find it useful for? Dictionaries :) > How about on custom classes? Same here. > Can anyone give me some good tips or hints for writing and using > hash functions in Python? Well, the usual tip for writing ...

hash function
Hello, All! I met this implementation of hash function, but can't figure out which method is used here. Google links are welcomed: unsigned int hash(ino_t ino, dev_t dev, off_t size, time_t ctime) { unsigned int h = 177573; h ^= ino; h += h << 5; h ^= dev; h += h << 5; h ^= size; h += h << 5; h ^= ctime; return h & hash_mask; } With best regards, Roman Mashak. E-mail: mrv@tusur.ru Roman Mashak wrote: > I met this implementation of hash function, but can't figure out which > method is used here. Google links are ...

Hash function
Dear Friends I bet I'm wrong in a childish way but I'm incapable to overcome the bug. Why does the following code return discrepant values when processing two identical file ( CRTL + C , CRTL + V ) placed in two different folders ? Of course, I'm looking on only the Hash part of the out, being obviously the folder related part. Warmest regards. Ignacio fileIdentifier[myFile_]:=Module[{ tmp , folderPos }, folderPos = StringPosition[myFile,"\\"]//Flatten//Max; tmp={ FileByteCount[myFile], Hash[myFile,"SHA512"], StringJoin[ ...

How to hash a function?
I'm using the latest PltScheme. I thought I'd play with a Forth'ish idea - and wanted to create a hash table of functions. So what I've got so far is: (require (lib "setf.ss" "swindle")) (define stack '()) (define dict (make-hash-table)) (define (list-dict) (hash-table-for-each dict (lambda (k v) (display k) (newline)))) (define (add-word str sym) (hash-table-put! dict str sym)) (define (push n) (push! n stack)) (define (pop) (pop! stack)) (define (/read) (push (read...

hashing function
I'm working with some large (several hundred megs) flat database files. I need to examine the records for duplicates. Obviously, I don't want to store several hundred megs of data in a hash. What I'd like to do is to read each record, generate a hash value for the record, store that hash value and an index key rather than storing the entire record, and look for collisions in the hash value. Perl obviously uses an internal hashing function to create it's hash variables. Is it possible to access this function or to get the actual hash value it produces? If not, any pointe...

Hashing Function
Hello All, I'm wondering what hashing function Python uses for dictionaries. Thanks for your help. Dave __________________________________ Yahoo! Mail - PC Magazine Editors' Choice 2005 http://mail.yahoo.com ...

hash functions
Can someone direct me to fortran source code for popular or effective hashing functions, such as sha1 or md5? This turns out to be hard to search for, because of all the messages mentioning various hashes in headers or sigs. Daniel Feenberg drfremove@nber.org wrote: > Can someone direct me to fortran source code for popular or effective > hashing functions, such as sha1 or md5? This turns out to be hard to > search for, because of all the messages mentioning various hashes in > headers or sigs. Brent's hashing algorithm is implemented in Fortran 90 at http://users.bigpond....

hash function
i didn't understand what does it mean for a hash function to produce well-dispersed output, and why it is important? thank u for ur help zoro wrote: > i didn't understand what does it mean for a hash function to produce > well-dispersed output, and why it is important? Well, let us start with what is the worst possibility here w.r.t. dispersing: Hash function that returns always zero (or other constant number) is valid, but alters hashing search operation to linear search. By well-dispersed is meant the "opposite" to this situation... (as many different values fo...

hash function
Hi i need a hash function for some large strings (upto 1024 chars in the array) the following is not very good for these large strings: int string_hash(int hash_size, const char *key) { unsigned long n = 0; const char *p; for (p = key; *p != '\0'; p++) n = ((n << 8) + n) ^ (unsigned long)(*p); printf("n er: %i", n); return (n % hash_size); } Any ideas - Lars Tackmann wrote: > > Hi i need a hash function for some large strings (upto 1024 chars in > the array) the following is not very good for these large strings: hashlib.zip contains some string ha...

Hashing function
I want to look for some one-to-one hashing function. In C++, any one-to-one hashing function? Pat writes: > I want to look for some one-to-one hashing function. > > In C++, any one-to-one hashing function? I assume by one-to-one you mean perfect hashing. There is no such thing in the standard libraries, I would search google to see what you can dig up. "Pat" <Pat@Pat.com> wrote in message news:40aa3b32$1_2@rain.i-cable.com... > I want to look for some one-to-one hashing function. > > In C++, any one-to-one hashing function? Assuming you are looking ...

hash functions
I have a very simple Position data type containing two nonnegative ints, x and y. Obviously position1.equals(position2) iff they have identical x and y coordinates. I am using them as keys to a hashmap; does anyone have any suggestions as to the most efficient hash function for such a structure? It seems like I can get some optimizations that improve on hash functions with arbitrary-length input, but I'm not sure exactly how. Thanks. Thomas Nelson wrote: > I have a very simple Position data type containing two nonnegative ints, > x and y. Obviously position1.equals(pos...

[C++0x] Hashing functions combined of std::hash for build-in types
The proposed std::hash template defines only specializations for build-in types, pointers, strings (string,u16string,u32string and wstring), error_code and thread::id. People probably will want to use std::unordered_set or unordered_map with user defined types or even const char*. As implementing a reasonable hash function is not trivial, people will end up with bad hashing functions for these types. The boost implementation has two template functions for this purpose: hash_combine and hash_range, which is documented here: http://www.boost.org/doc/libs/1_35_0/doc/html/hash/combine.html I su...

Who uses SRFI 69 or R6RS hash tables with arbitrary hash functions?
I'd like to hear from Schemers who make use of hash tables, either the SRFI= 69 or the R6RS flavor, that need to go beyond the classic five equivalence= predicates, namely `eq?`, `eqv?`, `equal?`, `string=3D?`, and `string-ci= =3D?`. When do you use them? What equivalence predicates do you use? Wha= t hash functions accompany them? Note that in SRFI 69, you can use the `hash` hash procedure for `eqv?` as w= ell as `equal?` hash tables, and in R6RS, you can use the `equal-hash` hash= procedure for `string=3D?` as well as `equal?`. John Cowan writes: > I'd like to ...

HMAC (Hash-based message authentication code) implementation SHA-256 hash function
Hi, I am desperately trying to make a HMAC SHA-256 function. I make use of the DataHash function kindly provided by Jan Simon here: http://www.mathworks.com/matlabcentral/fileexchange/31272-datahash What I need is a function HMAC(Key, Message) that calculates the keyed-hash message authentication code outputted in HEX. I realize my use of uint8 might not be as smooth as it could be, but so far this is what I've done. I am trying to emulate the pseudo-code from the wiki article on the subject: http://en.wikipedia.org/wiki/Hash-based_message_authentication_code#Implementation ...

Passing a hash to a function
I can't seem to find in in my perl book. I'd like to pass hashes to functions #!/usr/bin/perl -wT my %someHash; $someHash{'one'} = "1"; $someHash{'two'} = "2"; $someHash{'three'} = "3"; sub onsiestwosies { do stuff with %someHash } I'd simply like to pass %someHash to onesiestwosies. -- Mark Heaely marknews(at)healeyonline(dot)com Also sprach Mark Healey: > I can't seem to find in in my perl book. I'd like to pass hashes to > functions > > #!/usr/bin/perl -wT > > my ...

Hash of functions in modules
Hi, I have code like this: if ($cmd eq "get") { $self->get(); } elsif ($cmd eq "set") { $self->set(); } elsif ($cmd eq "copy") { $self->copy(); } I want to put it inside hash of function. How do I do that? I know I can do: %hof = ( get => \&get, set => \&set, copy => \&copy ); $hof{$cmd}->(); But I will lose the $self in the function. How do I pass $self to the function too as well? Vito Corleone wrote: > if ($cmd eq "get") { $self->get(); } > elsif ($cmd eq "set") { $self->...

Designing a hash function
I have a program which takes in as input a set of strings. Output of my program is a map which has the string as key and an object as value.I need to persist the key/value pairs at the end of the session (ie when my program exits). Next time when i restart my program, I hydrate the objects based on the strings I see in the input .For instance If i persisted S1 in the previous session and I see the string S1 in my current session then instead of paying the creation cost of the object, i do a lookup key=S1 and hydrate the object from the persistent store. Problem is I do not want to store th...

Collection of Hash Functions
Hello group! I am looking for hash functions which produce 32 bit output values from an arbitrary long byte input value. I want to run some tests on them if they are good for my purpose. Actually collisions do not matter only diffusion and distribution. I already collected following hash functions (i know some of them are meant for string hashing but i figured they might be good for my purpose too). Do you have any more suggestions? Cheers Christian from: http://www.burtleburtle.net/bob/hash/doobs.html 1=2E BOB lookup3.c 2=2E OATH One-at-a-Time Hash http://bretm.home.comcast.net/hash/Hash...

Hash function of structs
Hello, I'm looking for an hash function to be used for an hash table that will contain structs of a certain kind. I've looked into Sourceforge.net, but so far I've found only hash functions for strings (string->index)...Do you know if there exist such a function somewhere? Thanks Alexander Mahone wrote: > > Hello, I'm looking for an hash function to be used for an hash > table that will contain structs of a certain kind. I've looked > into Sourceforge.net, but so far I've found only hash functions > for strings (string->index)...Do you know if the...