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 29512 articles. 32 followers. Post

1 Replies
280 Views

Similar Articles

[PageSpeed] 27


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

Hash of hashes, of hashes, of arrays of hashes
Hi, I'm trying to create a data structure that will (eventually) make it easier to create a series of slightly different XML documents. The structure will effectively hold a template. Here's a section of code I am stuck on: #!/usr/bin/perl -w use strict; use Data::Dumper; my %xmldoc = ( doc1 => { customer => [{name => 'count', format => 'int'}, {name => 'unit', format => 'text'}, ], order => [{name => 'expected', format => 'date'}, ], ...

hash of hash of hash of hash in c++
Hello, is it possible to write the below Perl code in C++ ? The code creates a hash which contains hashes of hashes of hashes which contain a key called "count" which is incremented if it exists. Thanks for your help. rp ----------------------------------------- #!/opt/local/bin/perl use strict; use warnings; my %hash = (); for (my $y = 2000; $y < 2010; ++$y) { for (my $m = 1; $m < 12; ++$m) { for (my $d = 1; $d < 30; ++$d) { process(\%hash, $y, $m, $d); } } } for (my $y = 2000; $y < 2010; ++$y) { for (my $m = 1; $m < 12; ++$m) { for (my $d = 1; $d <...

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 ...

Calling functions from functions from functions ...
Lets say I have a function g(p,x) where x and p are of some defined type. I also have a function NewtonR which I can use like so: x = NewtonR(g,p,x0) There is also another function I want to call ImplicitTrap which can be done as: u = ImplicitTrap(g,p,u0,step,n) This function defines a function of g, and it is this function that I'd like to pass to NewtonR. Can it be done? Basically the code is implementing the implicit trapezoidal rule for numerical integration with the NR solver being used at each step with automatic differentiation being used to handle the differentiation. M...

Iterating over a hash of hash of hashes
Is there a more "rubyesque" idiom for iterating of a multi-dimensional hash other than the following: workq_dev.get_all_zapps.each do |k,v| print "#{k} ==> " v.each do |k,v| puts "#{k} ==> " puts v.class v.each { |k,v| puts "#{k} ==> #{v}" } end end thanks in advance! -- Posted via http://www.ruby-forum.com/. ...

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...

Hashes of hashes?
I have this: use strict; my %my_hash = (); $my_hash{'1'}{'a'} = "Hello"; $my_hash{'1'}{'b'} = "world!"; $my_hash{'2'}{'c'} = "Foo"; $my_hash{'2'}{'d'} = "bar"; And I want to do something like this: foreach my $k (keys $my_hash{'1'}) { print "$k\n"; } Should give the output of: a b But of course the above code is wrong. How do I correct it? Thanks. -- Arcadio asincero wrote: > I have this: > > use strict; > my %my_hash = (); > > $my_hash{...

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[ ...

When is a function not a function?
I've got a collection of functions that accept a function or object (paired with a method name) as a callback. For the longest time I have relied on this test. (typeof cb == 'function') This should work as well, but I am not sure how well it degrades in older browsers. I think there are issues with functions created in another context (eg frame) as well. (cb instanceof Function) Then I came across this. (!!fn && typeof fn != "string" && !fn.nodeName && fn.constructor != Array && /function/i.test( fn + "" )) I'm sure it...

Function functionality
Hey, I&#8217;m sure this is something that is relatively easy to code for, but I haven&#8217;t been able to do it easily without generating lots of different error messages! Basically, I created an M-file, let&#8217;s say it&#8217;s called Batch_Run, and I want it&#8217;s operation to differ depending on what the user types in the command window. For example, currently, if the user types &#8216;Batch_Run&#8217; in the command window, MatLab processes ALL the files in the current directory using the code in the M-file. However, I would also like it so that if the use...

function of a function
Tried to solve numerically: http://groups.google.com/group/sci.math/browse_frm/thread/248f76d024c1ac57/0bba983777a07bc9#0bba983777a07bc9 thus: EQ= { f'[x] == f[f[x]], f[0]== 1} ; NDSolve[EQ,f,{x,0,2}]; But gives an error. NDSolve::ndnum: Differential equation does not evaluate to a number at x = 0. Also does not work even with other f[0] values. Any way to do that? Hi, it can't work because f[0]==1 give in your differential equation f'[0]==f[1] and NDSolve[] can't find the value for f[1] until it has integrated the equation. The neted dependence...

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...

Function with a function
I have a GUI that calls a separate function (a different m-file) to perform a certain task. Since this task takes several minutes to complete, I would like to place some frames on the GUI to show progress as the second function runs. These frames would change colors upon getting to certain stages of the code. I am able to get the frames to change color but they do so only after the second function is finished running. Obviously this is no good. A sample of my code is as follows: set(findobj('Tag',['frame2']),'BackgroundColor','green'); This code is contained w...

hash of hash
Hi everyone, I am a bit stuck with a script. Here is the problem: I have a script wich creates an output like that: aa1 0.1 0.2 0.55 aa2 -0.4 0.3 -0.4 aa3 0.04 -0.4 0.1 ........... and I would like to "invert" it in: aa1 aa2 aa3 1 0.1 -0.4 0.04 2 0.2 0.3 -0.4 3 0.55 -0.4 0.1 any idea? I don't post the script because it is quite long. thanks regards xspirix Andrea Spitaleri wrote: > I am a bit stuck with a script. > Here is the problem: > I have a script wich creates an output like that: > > aa1 0.1 0.2 0.55 > aa2 -0.4...

Hash + Hash ?
when two hash add together it will merge into one hash . how about a hash of hash ? hashA:hashX, hashB:hashX ? how to make the hash of hash to merge instead of overwirte by the last one ? thanks -- .. ...

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...

hash of hashes
Hi all. How can I create $Subject for future population? -- Yours truly, WBR, Paul Argentoff. Jabber: paul@jabber.rtelekom.ru RIPE: PA1291-RIPE On Friday 03 October 2003 14:04, Paul Argentoff wrote: > How can I create $Subject for future population? Let's put it this way: I need to create a nested hash which will be populated later by referencing the keys in the subhashes. How can I do this? -- Yours truly, WBR, Paul Argentoff. Jabber: paul@jabber.rtelekom.ru RIPE: PA1291-RIPE Paul Argentoff wrote: >On Friday 03 October 2003 14:04, Paul Argentoff wrote: > > > ...

hash of hashes
if hash is used, i think in java it can be used as, if the statement in perl is, $names{$branch}=0; equivalent to, if (branch.length() > 0) names.put(branch, new Integer(0)); In perl a "hash of hashes" is used as, $names{$branch}{$account}=0; i would like to know how it can be coded in java? -Mani "Mani" <a.mani24@yahoo.com> wrote in message news:1149273928.083515.252630@h76g2000cwa.googlegroups.com... > > if hash is used, i think in java it can be used as, > > if the statement in perl is, > > $names{$branch}=0; > > equivalent ...

Functions of Functions
Hello, I was wondering if anyone could help me with this. I've gone through the book and help files as best I can, but can't seem to figure out why the following doesn't work: I'm trying to work with functions that take functions as parameters and return other functions. Below is an example... (*clear stuff*) Clear[a, b, c, x] (*Define a functions a*) \!\(a[x_] := \((Sin[x] + x\^3\/2)\)\) (*define a function of functions*) \!\(b[f_] = \((f'' + \(3\ f'\)\/2 + 5 f)\)\) (*apply the functional function to a*) c = b[...