|
|
|
@ -159,15 +159,15 @@ and these came close:
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
--------------------------------------------------------------------
|
|
|
|
|
This works on all machines. To be useful, it requires
|
|
|
|
|
-- that the key be an array of uint32_t's, and
|
|
|
|
|
-- that the length be the number of uint32_t's in the key
|
|
|
|
|
This works on all machines. To be useful, it requires
|
|
|
|
|
-- that the key be an array of uint32_t's, and
|
|
|
|
|
-- that the length be the number of uint32_t's in the key
|
|
|
|
|
|
|
|
|
|
The function hashword() is identical to hashlittle() on little-endian
|
|
|
|
|
machines, and identical to hashbig() on big-endian machines,
|
|
|
|
|
except that the length has to be measured in uint32_ts rather than in
|
|
|
|
|
bytes. hashlittle() is more complicated than hashword() only because
|
|
|
|
|
hashlittle() has to dance around fitting the key bytes into registers.
|
|
|
|
|
The function hashword() is identical to hashlittle() on little-endian
|
|
|
|
|
machines, and identical to hashbig() on big-endian machines,
|
|
|
|
|
except that the length has to be measured in uint32_ts rather than in
|
|
|
|
|
bytes. hashlittle() is more complicated than hashword() only because
|
|
|
|
|
hashlittle() has to dance around fitting the key bytes into registers.
|
|
|
|
|
--------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
uint32_t hashword(
|
|
|
|
@ -215,10 +215,10 @@ both be initialized with seeds. If you pass in (*pb)==0, the output
|
|
|
|
|
--------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
void hashword2 (
|
|
|
|
|
const uint32_t *k, /* the key, an array of uint32_t values */
|
|
|
|
|
size_t length, /* the length of the key, in uint32_ts */
|
|
|
|
|
uint32_t *pc, /* IN: seed OUT: primary hash value */
|
|
|
|
|
uint32_t *pb) /* IN: more seed OUT: secondary hash value */
|
|
|
|
|
const uint32_t *k, /* the key, an array of uint32_t values */
|
|
|
|
|
size_t length, /* the length of the key, in uint32_ts */
|
|
|
|
|
uint32_t *pc, /* IN: seed OUT: primary hash value */
|
|
|
|
|
uint32_t *pb) /* IN: more seed OUT: secondary hash value */
|
|
|
|
|
{
|
|
|
|
|
uint32_t a,b,c;
|
|
|
|
|
|
|
|
|
@ -442,7 +442,6 @@ uint32_t hashlittle( const void *key, size_t length, uint32_t initval)
|
|
|
|
|
case 0 : return c;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
final(a,b,c);
|
|
|
|
|
return c;
|
|
|
|
|
}
|
|
|
|
@ -671,7 +670,7 @@ uint32_t hashbig( const void *key, size_t length, uint32_t initval)
|
|
|
|
|
* does it on word boundaries, so is OK with this. But VALGRIND will
|
|
|
|
|
* still catch it and complain. The masking trick does make the hash
|
|
|
|
|
* noticeably faster for short strings (like English words).
|
|
|
|
|
*/
|
|
|
|
|
* */
|
|
|
|
|
#ifndef VALGRIND
|
|
|
|
|
|
|
|
|
|
switch(length)
|
|
|
|
@ -802,11 +801,10 @@ void driver2()
|
|
|
|
|
{
|
|
|
|
|
for (j=0; j<8; ++j) /*------------------------ for each input bit, */
|
|
|
|
|
{
|
|
|
|
|
for (m=1; m<8; ++m) /*------------ for several possible initvals, */
|
|
|
|
|
for (m=1; m<8; ++m) /*------------ for serveral possible initvals, */
|
|
|
|
|
{
|
|
|
|
|
for (l=0; l<HASHSTATE; ++l)
|
|
|
|
|
e[l]=f[l]=g[l]=h[l]=x[l]=y[l]=~((uint32_t)0);
|
|
|
|
|
|
|
|
|
|
/*---- check that every output bit is affected by that input bit */
|
|
|
|
|
for (k=0; k<MAXPAIR; k+=2)
|
|
|
|
|
{
|
|
|
|
@ -845,7 +843,7 @@ void driver2()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
done:
|
|
|
|
|
done:
|
|
|
|
|
if (z < MAXPAIR)
|
|
|
|
|
{
|
|
|
|
|
printf("Mix success %2d bytes %2d initvals ",i,m);
|
|
|
|
@ -947,7 +945,7 @@ void driver3()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* check for problems with nulls */
|
|
|
|
|
void driver4()
|
|
|
|
|
void driver4()
|
|
|
|
|
{
|
|
|
|
|
uint8_t buf[1];
|
|
|
|
|
uint32_t h,i,state[HASHSTATE];
|
|
|
|
|